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
10 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...
-
10:28
BlabberingCollector
13 hours agoAsk Blabs, Episode 5 | Answering Your Wizarding World Related Questions
7.93K1 -
18:09
Forrest Galante
5 days agoI Survived 24 Hours In The World's Deadliest Jungle
187K30 -
LIVE
Lofi Girl
2 years agoSynthwave Radio 🌌 - beats to chill/game to
304 watching -
2:15:09
Badlands Media
17 hours agoOnlyLands Ep. 27: Power Hour Hangover, Trump’s Wartime Shift, and Portland in Flames
113K26 -
22:21
DeVory Darkins
7 hours ago $17.63 earnedRioters attack Portland ICE Facility as Democrats make shocking admission
22.8K87 -
2:06:06
TimcastIRL
9 hours agoTrump DOJ Announces INTERVENTION In Portland Over Nick Sortor Arrest | Timcast IRL
238K388 -
6:53:58
SpartakusLIVE
11 hours ago#1 All-American HERO with LUSCIOUS hair and AVERAGE forehead brings Friday Night HYPE
68.9K7 -
3:06:43
Laura Loomer
9 hours agoEP147: Islamic Terror EXPLODES In The West After UK Synagogue Attack
52.9K43 -
1:02:50
Flyover Conservatives
15 hours agoEric Trump: America’s Most Subpoenaed Man SPEAKS OUT! | FOC Show
45.8K14 -
3:36:44
PandaSub2000
1 day agoSuper Mario Galaxy 1 & 2 | ULTRA BEST AT GAMES (Original Live Version)
35K3