《判断回文》
判断回文
http://www.nowcoder.com/questionTerminal/e297fdd8e9f543059b0b5f05f3a7f3b2
直接双指针
import java.util.*; public class Solution { public boolean judge (String str) { // write code here int n = str.length(); if(n == 0 || n == 1) return true; int left = 0, right = n-1; while(left < right){ if(str.charAt(left) != str.charAt(right)) return false; left++; right--; } return true; } }