We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e567e5 commit 9d14dedCopy full SHA for 9d14ded
valid-palindrome/Gotprgmer.java
@@ -8,9 +8,8 @@
8
// 공간복잡도 : O(n)
9
10
class Solution_Gotprgmer {
11
- static StringBuilder sb;
12
- public boolean isPalindrome(String s) {
13
- sb = new StringBuilder();
+ public boolean validPalindrome(String s) {
+ StringBuilder sb = new StringBuilder();
14
for(char charToCheck : s.toCharArray()){
15
if(!Character.isLetterOrDigit(charToCheck)){
16
continue;
@@ -20,12 +19,6 @@ public boolean isPalindrome(String s) {
20
19
String originalDirection = sb.toString();
21
String reDirection = sb.reverse().toString();
22
23
- if(originalDirection.equals(reDirection)){
24
-
25
- return true;
26
- }
27
- else{
28
- return false;
29
+ return originalDirection.equals(reDirection);
30
}
31
0 commit comments