Skip to content

Commit

Permalink
Time: 14 ms (34.30%), Space: 45.4 MB (16.66%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
YubinShin committed Aug 26, 2024
1 parent 847a138 commit 5a89635
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 0125-valid-palindrome/0125-valid-palindrome.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Solution {
public boolean isPalindrome(String s) {
String processedString = s.replaceAll("[^a-zA-Z0-9]", "").toLowerCase();
String reversedString = new StringBuilder(processedString).reverse().toString();
if (processedString.equals(reversedString)) {
return true;
}
return false;
}
}

0 comments on commit 5a89635

Please sign in to comment.