判断是否为回文字符串

 public boolean judge (String str) {
        // write code here
        
        int i=0,j=str.length()-1;
        
        while (i<j){
            
            if(str.charAt(i++)!=str.charAt(j--)) return false;
            
        }
        
        return true;
        
    }
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务