更新 Solution.java
parent
87b994cf7d
commit
ce26795849
|
|
@ -1,2 +1,15 @@
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Solution {
|
||||
public int lengthOfLongestSubstring(String s) {
|
||||
if (s != null){
|
||||
Set<Character> stringList = new HashSet<>();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
stringList.add(s.charAt(i));
|
||||
}
|
||||
return stringList.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue