Created
October 27, 2020 01:05
-
-
Save rjlutz/1fa396f2d2ef2f3f1b6c0310e955a1cc 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
main() { | |
// should result in true,false,true,false,true,false | |
print(Palindrome.check('radar')); | |
print(Palindrome.check('raxdar')); | |
print(Palindrome.check('noon')); | |
print(Palindrome.check('nxoon')); | |
print(Palindrome.check('Rise to vote, sir!')); | |
print(Palindrome.check('Rise to xyz vote, sir!')); | |
} | |
class Palindrome { | |
static check(String s) { | |
return s == String.fromCharCodes(s.runes.toList().reversed); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment