임시
public int uniqueLetterString(String S) {
int size = 0;
List<String> prefix = getPrefix();
for(String word : prefix) {
Set<Character> set = new HashSet<>();
for(int i=0;i<word.length;i++) {
set.add(word[i]);
}
size+=set.size();
set = new HashSet();
}
}
private List<String> getPrefix(String s) {
List<String> prefix = new ArrayList();
int j = 1;
for(int i = 0;i < s.length(); i++) {
while(j!=s.length()-1) {
prefix.add(s.subString(i,j))
++j;
}
j=i+1;
}
}
int size = 0;
List<String> prefix = getPrefix();
for(String word : prefix) {
Set<Character> set = new HashSet<>();
for(int i=0;i<word.length;i++) {
set.add(word[i]);
}
size+=set.size();
set = new HashSet();
}
}
List<String> prefix = new ArrayList();
int j = 1;
for(int i = 0;i < s.length(); i++) {
while(j!=s.length()-1) {
prefix.add(s.subString(i,j))
++j;
}
j=i+1;
}
}
댓글
댓글 쓰기