We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf02135 commit 914f09cCopy full SHA for 914f09c
valid-palindrome/choidabom.ts
@@ -0,0 +1,11 @@
1
+// https://leetcode.com/problems/valid-palindrome/
2
+
3
+// TC: O(n)
4
+// SC: O(n)
5
6
+function isPalindrome(s: string): boolean {
7
+ const str = (s.toLowerCase().match(/[a-z0-9]/g) || []).join("");
8
+ const reverse = str.split("").reverse().join("");
9
10
+ return str === reverse;
11
+}
0 commit comments