Skip to content

Instantly share code, notes, and snippets.

@rjlutz
Created October 27, 2020 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjlutz/1fa396f2d2ef2f3f1b6c0310e955a1cc to your computer and use it in GitHub Desktop.
Save rjlutz/1fa396f2d2ef2f3f1b6c0310e955a1cc to your computer and use it in GitHub Desktop.
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