Created
January 3, 2021 11:28
-
-
Save darkcris1/9f2a0db7b85885c23217b4f832281f74 to your computer and use it in GitHub Desktop.
Strange Root | SoloLearn
This file contains 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 strangeRoot(n) { | |
const sqrt = Math.sqrt(n) | |
.toFixed(3) | |
.replace(/\.(0{3})$/, '') | |
return new RegExp(n * n).test(sqrt) | |
} | |
console.log(strangeRoot(2)) // true | |
// Strange Root Visualize | |
// https://code.sololearn.com/WyEsHZldtkkB/# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment