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...
-
1:04:10
The Connect: With Johnny Mitchell
8 hours ago $3.33 earnedTucker Carlson's INSANE Take On Civil War In America, Calls For Fascism
18.6K38 -
2:35:14
DLDAfterDark
6 hours ago $3.30 earnedThe Return of Marine Gun Builder? MGB, DLD, BDG&G After Hours Armory
20.9K3 -
28:39
Afshin Rattansi's Going Underground
1 day agoDonald Trump’s Gaza Peace Plan: A Pivotal Moment or Farce? (Palestinian Deputy Foreign Minister)
27.4K6 -
3:31:29
SavageJayGatsby
7 hours ago🔥 Spicy Saturday – Let's Play: Prison Life 2🔥
45K2 -
4:34:18
cosmicvandenim
14 hours agoCOSMIC VAN DENIM | WARZONE HORROR
18.8K1 -
29:09
Stephen Gardner
11 hours ago🚨Trump DECLARES WAR on TERRORIST LEFT!
31.3K60 -
4:16:00
NellieBean
6 hours ago🔴 Lost Girl looks for Lost Village
9.48K -
30:07
JohnXSantos
1 day ago $1.02 earnedWhy Clothing Brands NEVER Fail- Master Class
8.53K -
4:08:42
Spartan
5 hours agoOMiT Spartan | God of War Ragnarok, College Halo match @ 9:30 EST, then ranked or more GoW:R
4.82K -
2:36:35
John_Goetz
5 hours agoJohn Gets Gaming - Ghost of Yotei
3.31K