Created
November 30, 2020 22:42
-
-
Save limbalrings/23154b75347054d513f21031f2858ab5 to your computer and use it in GitHub Desktop.
code read sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\\ ******** | |
\\ Sample #1 | |
\\ ******** | |
public static String noName1(String content, String stuff) { | |
for (int i = 0; i < stuff.length(); i++) { | |
for (int j = content.length() - 1; j >= 0; j--) { | |
if (stuff.charAt(i) == content.charAt(j)) { | |
content = utilityFunction(content, 0, j) + | |
utilityFunction(content, j + 1, content.length() - (j + 1)); | |
continue; | |
} | |
} | |
} | |
return content; | |
} | |
static String utilityFunction(String s, int off, int len) { | |
char[] n = new char[len]; | |
for (int i = 0; i < len; i++) { | |
n[i] = s.charAt(i+off); | |
} | |
return new String(n); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment