let randomNum = (max, min, degree) =>{
let arr = [];
let ifStop = false;
for(let i=0; i < degree; i++){
arr.push(Math.floor(Math.random()*(max-min+1)+min))
}
return arr
}
let arr =randomNum(20,0,20)
var twoSum = function(arr, target) {
let newArr = []
for(let i=0;i<arr.length;i++){
for(let j=0;j<arr.length;j++){
if(i!=j & arr[i]+arr[j]==target){
newArr.push([i,j])
}
}
}
for(let i=0;i<newArr.length;i++){
for(let j=0;j<newArr.length;j++){
if(j!=i){
if(newArr[i].includes(newArr[j][0],newArr[j][1])){
newArr.splice(j,1)
}
}
j--
}
}
return newArr
};
console.log(arr)
console.log(twoSum(arr,18))
console