1.1---判断字符串是否所有字符都不相同(CC150)

import java.util.*;
 
public class Different {
    public boolean checkDifferent(String str) {
        // write code here
        for(int i = 0; i < str.length(); i++){
            for(int j = i + 1; j < str.length(); j++){
                if(str.charAt(i) == str.charAt(j)) return false;
            }
        }
        return true;
    }
}

 

posted @ 2015-12-16 17:29  创业-李春跃-增长黑客  阅读(301)  评论(0编辑  收藏  举报