Skip to content

Instantly share code, notes, and snippets.

@MacTanomsup
Created November 17, 2018 05:28
Show Gist options
  • Select an option

  • Save MacTanomsup/1960c5eab2cc92b54e1b6edaf0ec356e to your computer and use it in GitHub Desktop.

Select an option

Save MacTanomsup/1960c5eab2cc92b54e1b6edaf0ec356e to your computer and use it in GitHub Desktop.
function same(arr1, arr2){
if(arr1.length !== arr2.length){
return false;
}
for(let i = 0; i < arr1.length; i++){
let correctIndex = arr2.indexOf(arr1[i] ** 2)
if(correctIndex === -1) {
return false;
}
arr2.splice(correctIndex,1)
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment