Compare commits

..

No commits in common. "486c2e2ebf71a1473811c216ee35aff6a97d043e" and "61f2db0b7290ca244b65919f152420a50d4e68f1" have entirely different histories.

5 changed files with 4 additions and 87 deletions

2
.gitignore vendored
View File

@ -56,4 +56,4 @@ hs_err_pid*
replay_pid*
>>>>>>> gitea/master
.idea/
idea/

View File

@ -5,10 +5,7 @@
</component>
<component name="ChangeListManager">
<list default="true" id="45f625e1-36c7-4942-8f7c-ba3ebe9a7d53" name="变更" comment="">
<change afterPath="$PROJECT_DIR$/src/solution/test.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Solution.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/solution/Solution.java" 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" />
@ -50,26 +47,6 @@
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RunManager">
<configuration name="test" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="solution.test" />
<module name="Solution" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="solution.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="应用程序.test" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="默认任务">
@ -78,22 +55,11 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1693822719192</updated>
<workItem from="1693822720224" duration="5742000" />
<workItem from="1693822720224" duration="1148000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/solution/test.java</url>
<line>36</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

View File

@ -1,2 +1,2 @@
# solution.Solution
# Solution

View File

@ -1,5 +1,3 @@
package solution;
import java.util.HashSet;
import java.util.Set;

View File

@ -1,47 +0,0 @@
package solution;
public class test {
public static void main(String[] args) {
String s = "abcabcbb";
Character a = 'a';
// int length = lengthOfLongestSubstring(s);
// System.out.println(isInString(a,));
}
public static int lengthOfLongestSubstring(String s) {
StringBuilder longestString = new StringBuilder();
StringBuilder lastMaxString = new StringBuilder();
if (s != null){
for (int i = 0; i < s.length(); i++) {
char temp = s.charAt(i);
if (i == 0){
continue;
}
Character prChar = s.charAt(i-1);
if (prChar != temp){
boolean in = isInString(temp,longestString);
if (!in){
lastMaxString.append(temp);
}
}
}
return longestString.length();
}
return 0;
}
public static boolean isInString(Character a,StringBuilder b){
if (b != null) {
for (int i = 0; i < b.length(); i++) {
Character temp = b.charAt(i);
if (temp == a) {
return true;
}
}
}
return false;
}
}