Skip to content

Commit ce0ae12

Browse files
committed
add solution: valid-palindrome
1 parent 6613b45 commit ce0ae12

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

valid-palindrome/yihyun-kim1.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @param {string} s
3+
* @return {boolean}
4+
*/
5+
const isPalindrome = (s) => {
6+
const cleaned = s.toLowerCase().replace(/[^a-z0-9]/g, "");
7+
const flipped = cleaned.split("").reverse().join("");
8+
9+
return cleaned === flipped;
10+
};

0 commit comments

Comments
 (0)