题解 | #判断是否为回文字符串#
判断是否为回文字符串
http://www.nowcoder.com/practice/e297fdd8e9f543059b0b5f05f3a7f3b2
import java.util.*;
public class Solution {
public boolean judge (String str) {
int c = str.length()-1>>1;
int s1 = c-str.length()%2;
int s2 = c+1;
while(s1>=0 && s2<str.length()){
if(str.charAt(s1--)!=str.charAt(s2++)){
return false;
}
}
return true;
}
}