Skip to content

Commit 9401d25

Browse files
committed
add valid-palindrome solution
1 parent 5acf128 commit 9401d25

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

valid-palindrome/nakjun12.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function isPalindrome(s: string): boolean {
2+
const convertWord = s.toLowerCase().match(/[a-z0-9]/g) ?? [];
3+
const length = convertWord.length;
4+
for (let i = 0; i < length / 2; i++) {
5+
if (convertWord[i] !== convertWord[length - 1 - i]) {
6+
return false;
7+
}
8+
}
9+
10+
return true;
11+
}

0 commit comments

Comments
 (0)