Premium Only Content
This video is only available to Rumble Premium subscribers. Subscribe to
enjoy exclusive content and ad-free viewing.

1346. Check If N and Its Double Exist
Repost
17 days ago
9
Given an array arr of integers, check if there exist two indices i and j such that :
i != j
0 <= i, j < arr.length
arr[i] == 2 * arr[j]
Example 1:
Input: arr = [10,2,5,3]
Output: true
Explanation: For i = 0 and j = 2, arr[i] == 10 == 2 * 5 == 2 * arr[j]
Example 2:
Input: arr = [3,1,7,11]
Output: false
Explanation: There is no i and j that satisfy the conditions.
Constraints:
2 <= arr.length <= 500
-103 <= arr[i] <= 103
bool checkIfExist(int* arr, int arrSize) {
int n = arrSize;
for(int i=0; i<n; i++)
for(int j=i+1; j<2*n; j++)
if(arr[i] == 2*arr[j%n] && i != j%n){
printf("%d %d",arr[i],2*arr[j%n]);
return true;
}
return false;
}
Loading comments...
-
LIVE
2 MIKES LIVE
1 hour agoTHE MIKE SCHWARTZ SHOW with DR. MICHAEL J SCHWARTZ 12-19-2024
708 watching -
4:45
Gamazda
14 hours ago $12.95 earnedGuns N' Roses - Sweet Child O' Mine
59.4K46 -
1:25:28
CarlCrusher
16 hours agoUFO Plasma ORBs & Drones Above New Jersey | Catching REAL PROOF with Dr Jim Segala
51.9K20 -
24:40
Degenerate Plays
1 day ago $4.11 earnedI Put A Bounty On This Phone Addict - Madden NFL 09 : Part 1
31.7K1 -
18:29
Bearing
1 day agoCrazy Democrat Lady Thinks THE DRONES Are Coming For TRUMP & MAGA
28.6K54 -
53:41
PMG
1 day ago $6.03 earned"CNN Caught Issuing FAKE Report-Ashley Hayek"
32.3K4 -
57:22
barstoolsports
19 hours agoHardest Puzzle Breaks Brains | Surviving Barstool S4 Ep. 8
290K15 -
9:02:15
Dr Disrespect
23 hours ago🔴LIVE - DR DISRESPECT - MARVEL RIVALS - RANKED
407K70 -
1:00:46
The StoneZONE with Roger Stone
14 hours agoFake News Attack on Tulsi Gabbard! | The StoneZONE w/ Roger Stone
87.8K28 -
2:24:08
WeAreChange
17 hours agoElon Musk & Donald Trump: The Emergency Halt That Saved Us
108K67