Compare commits

..

2 Commits

Author SHA1 Message Date
wangsiyuan 61f2db0b72 更新 workspace.xml 2023-09-04 18:39:58 +08:00
wangsiyuan ce26795849 更新 Solution.java 2023-09-04 18:39:55 +08:00
2 changed files with 22 additions and 4 deletions

View File

@ -5,15 +5,20 @@
</component>
<component name="ChangeListManager">
<list default="true" id="45f625e1-36c7-4942-8f7c-ba3ebe9a7d53" name="变更" comment="">
<change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Solution.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Solution.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -50,7 +55,7 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1693822719192</updated>
<workItem from="1693822720224" duration="784000" />
<workItem from="1693822720224" duration="1148000" />
</task>
<servers />
</component>

View File

@ -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;
}
}