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
11 months 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...
-
2:16:35
BlackDiamondGunsandGear
8 hours agoEBT Apocalypse? / Snap Down SHTF / After Hours Armory
15.4K7 -
14:05
Sideserf Cake Studio
19 hours ago $12.87 earnedHYPERREALISTIC HAND CAKE GLOW-UP (Old vs. New) 💅
48.3K7 -
28:37
marcushouse
21 hours ago $6.97 earnedSpaceX Just Dropped the Biggest Starship Lander Update in Years! 🤯
21.7K7 -
14:54
The Kevin Trudeau Show Limitless
3 days agoThe Hidden Force Running Your Life
100K22 -
2:16:35
DLDAfterDark
8 hours ago $5.80 earnedIs The "SnapPocalypse" A Real Concern? Are You Prepared For SHTF? What Are Some Considerations?
21.9K9 -
19:58
TampaAerialMedia
19 hours ago $7.80 earnedKEY LARGO - Florida Keys Part 1 - Snorkeling, Restaurants,
36.7K17 -
1:23
Memology 101
2 days ago $7.07 earnedFar-left ghoul wants conservatives DEAD, warns Dems to get on board or THEY ARE NEXT
29.9K62 -
3:27:27
SavageJayGatsby
9 hours ago🔥🌶️ Spicy Saturday – BITE Edition! 🌶️🔥
56.8K6 -
26:09
Exploring With Nug
19 hours ago $12.27 earned13 Cold Cases in New Orleans What We Discovered Beneath the Surface!
53K23 -
27:39
MYLUNCHBREAK CHANNEL PAGE
14 hours agoDestroying Time.
135K41