given an array arr of integers 2c check if there exists two input

Solutions on MaxInterview for given an array arr of integers 2c check if there exists two input by the best coders in the world

showing results for - "given an array arr of integers 2c check if there exists two input"
Alice
15 May 2018
1 var checkIfExist = function(arr) {
2     for(let i=0;i<arr.length;i++){
3         let target = arr[i]
4         for(let j=i+1;j<arr.length;j++){
5             if(target === arr[j]*2 || target === arr[j]/2){
6                 return true
7             }
8         }
9     }
10     return false
11 };
12