File tree Expand file tree Collapse file tree 1 file changed +0
-30
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Original file line number Diff line number Diff line change 11package com .fishercoder .solutions ;
22
3- /**
4- * 1346. Check If N and Its Double Exist
5- *
6- * Given an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M).
7- *
8- * More formally check if there exists two indices i and j such that :
9- *
10- * i != j
11- * 0 <= i, j < arr.length
12- * arr[i] == 2 * arr[j]
13- *
14- * Example 1:
15- * Input: arr = [10,2,5,3]
16- * Output: true
17- * Explanation: N = 10 is the double of M = 5,that is, 10 = 2 * 5.
18- *
19- * Example 2:
20- * Input: arr = [7,1,14,11]
21- * Output: true
22- * Explanation: N = 14 is the double of M = 7,that is, 14 = 2 * 7.
23- *
24- * Example 3:
25- * Input: arr = [3,1,7,11]
26- * Output: false
27- * Explanation: In this case does not exist N and M, such that N = 2 * M.
28- *
29- * Constraints:
30- * 2 <= arr.length <= 500
31- * -10^3 <= arr[i] <= 10^3
32- * */
333public class _1346 {
344 public static class Solution1 {
355 public boolean checkIfExist (int [] arr ) {
You can’t perform that action at this time.
0 commit comments