描述
实现一个算法确定字符串中的字符是否均唯一出现
样例
给出”abc”,返回 true
给出”aab”,返回 false
java code
public class Solution {
/**
* @param str: a string
* @return: a boolean
*/
public boolean isUnique(String str) {
// write your code here
for(int i=0; i<str.length()-1; i++) {
for(int j=i+1; j<str.length(); j++) {
if(str.charAt(i) == str.charAt(j)) {
return false;
}
}
}
return true;
}