更新 Solution.java
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user