|
@@ -1,12 +1,26 @@
|
1
|
1
|
package rocks.zipcode.io.quiz4.fundamentals;
|
2
|
2
|
|
|
3
|
+import java.util.ArrayList;
|
|
4
|
+import java.util.List;
|
|
5
|
+
|
3
|
6
|
/**
|
4
|
7
|
* @author leon on 11/12/2018.
|
5
|
8
|
*/
|
6
|
9
|
public class StringEvaluator {
|
7
|
10
|
public static String[] getAllPrefixes(String string) {
|
8
|
11
|
|
9
|
|
- return null;
|
|
12
|
+ StringBuilder builder = new StringBuilder();
|
|
13
|
+ int index = 0;
|
|
14
|
+// for (int j = 0; j < string.length()-1; j++) {
|
|
15
|
+
|
|
16
|
+ for (int i = 0; i < string.length(); i++) {
|
|
17
|
+ builder.append(string.charAt(i) + ",");
|
|
18
|
+ for (int j = 1; j < string.length()-1; j++) {
|
|
19
|
+ builder.append(string.substring(i) + ",");
|
|
20
|
+ }
|
|
21
|
+ }
|
|
22
|
+
|
|
23
|
+ return builder.toString().split(",");
|
10
|
24
|
}
|
11
|
25
|
|
12
|
26
|
public static String[] getCommonPrefixes(String string1, String string2) {
|