We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 408f184 commit 6e44a93Copy full SHA for 6e44a93
valid-palindrome/Totschka.ts
@@ -0,0 +1,10 @@
1
+// https://leetcode.com/problems/valid-palindrome/description/
2
+function isPalindrome(s: string): boolean {
3
+ s = s.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
4
+ for (let i = 0; i < s.length / 2; i++) {
5
+ if (s[i] !== s[s.length - 1 - i]) {
6
+ return false;
7
+ }
8
9
+ return true;
10
+}
0 commit comments