Skip to content

Commit ac45c39

Browse files
committed
solution
1 parent af4c796 commit ac45c39

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

contains-duplicate/Sol35229.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

valid-palindrome/Sol35229.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.Stack;
2+
3+
public class Sol35229 {
4+
5+
class Solution {
6+
public boolean isPalindrome(String s) {
7+
s = s.toLowerCase().replaceAll("[^a-z0-9]", "");
8+
int left = 0;
9+
int right = s.length() - 1;
10+
while (left < right) {
11+
if (s.charAt(left) != s.charAt(right)) {
12+
return false;
13+
}
14+
left++;
15+
right--;
16+
}
17+
return true;
18+
}
19+
// boolean isLowerCase(Character c) {
20+
// return (int) c > 96 && (int) c < 123 ? true : false;
21+
// }
22+
}
23+
}
24+

0 commit comments

Comments
 (0)