Created
November 17, 2018 05:28
-
-
Save MacTanomsup/1960c5eab2cc92b54e1b6edaf0ec356e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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