Skip to content

Commit d39ddcd

Browse files
committed
Add valid palindrome solution
1 parent 831b097 commit d39ddcd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

valid-palindrome/hyunjung-choi.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import java.util.Locale.getDefault
2+
3+
class Solution {
4+
fun isPalindrome(s: String): Boolean {
5+
if (s.isBlank()) return true
6+
val cleanedString = s.trim().filter { it.isLetterOrDigit() }.lowercase(getDefault())
7+
return cleanedString == cleanedString.reversed()
8+
}
9+
}

0 commit comments

Comments
 (0)