-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIsUnique.java
More file actions
21 lines (20 loc) · 527 Bytes
/
IsUnique.java
File metadata and controls
21 lines (20 loc) · 527 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package leetcode.string;
/**
* @ClassName IsUnique
* @Description 判定字符是否唯一
* @Author changxuan
* @Date 2020/9/1 下午10:12
**/
public class IsUnique {
public boolean isUnique(String astr) {
char[] strArr = astr.toCharArray();
for (int i = 0; i < strArr.length; i++){
char curr = strArr[i];
for (int j = i+1; j < strArr.length; j ++){
if (curr == strArr[j])
return false;
}
}
return true;
}
}