-
-
Save simon0191/373024988f45cc840ab6 to your computer and use it in GitHub Desktop.
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 main(str) { | |
var mid = str.length>>1; | |
for(var i = 0;i<mid;++i) { | |
if(str[i] !== str[str.length-1-i]) return false; | |
} | |
return true; | |
} | |
console.log(main('anitalavalatina')); | |
console.log(main('a')); | |
console.log(main('aaabbbbbbaaa')); | |
console.log(main('aaabbbxbbbaaa')); | |
console.log(main('aaabbb')); | |
console.log(main('aaaxbbb')); | |
console.log(main('aabbb')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment