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...
-
3:10:46
Ellie_roe
7 hours agoEllie and Errys Halloween Spooktacular || Random Horror Games
24.2K1 -
50:27
Sarah Westall
9 hours agoBig Banks Caught Rigging Market, IMF tells World to “Buckle Up” w/ Andy Schectman
43.6K17 -
13:54
Degenerate Jay
15 hours ago $1.15 earned5 Best Superhero Movies To Watch On Halloween
22.9K5 -
59:03
NAG Podcast
8 hours agoSarah Fields: BOLDTALK W/Angela Belcamino
39.4K9 -
1:21:41
Glenn Greenwald
11 hours agoGlenn Takes Your Questions: On the Argentina Bailout, Money in Politics, and More; Plus: Journalist Jasper Nathaniel on Brutality and Settler Attacks in the West Bank | SYSTEM UPDATE #541
92K47 -
3:10:08
Barry Cunningham
8 hours agoPRESIDENT TRUMP TO USE NUCLEAR OPTION? FOOD STAMPS END! | SHUTDOWN DAY 31
55.6K43 -
1:06:56
BonginoReport
16 hours agoThe Battle Between Good & Evil w/ Demonologist Rick Hansen - Hayley Caronia (Ep.168)
105K39 -
1:12:57
Kim Iversen
11 hours agoBill Gates Suddenly Says “Don’t Worry About Climate Change”?
94.1K67 -
1:05:12
Michael Franzese
11 hours agoI Waited 50 Years to Tell You What Happened on Halloween 1975
47.6K19 -
1:07:15
Candace Show Podcast
11 hours agoINFILTRATION: Charlie Kirk Was Being Tracked For Years. | Candace Ep 256
97.6K416