Skip to content

Commit 1fb41d8

Browse files
author
Ram swaroop
committed
code refactoring
1 parent f1868d9 commit 1fb41d8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/me/ramswaroop/strings/StringPermutationCount.java renamed to src/me/ramswaroop/strings/StringPermutationsCount.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @time: 10:32 AM
1212
* @see: me.ramswaroop.strings.StringPermutations for a simpler version
1313
*/
14-
public class StringPermutationCount {
14+
public class StringPermutationsCount {
1515

1616
/**
1717
* Finds the number of permutations of string {@param s1} that exists in string {@param s2}.
@@ -22,20 +22,20 @@ public class StringPermutationCount {
2222
* @param count
2323
* @return
2424
*/
25-
public static int getStringPermutationCount(String prefix, String s1, String s2, int count) {
25+
public static int getStringPermutationsCount(String prefix, String s1, String s2, int count) {
2626
if (s1.isEmpty()) {
2727
if (s2.indexOf(prefix) != -1) count++;
2828
}
2929

3030
for (int i = 0; i < s1.length(); i++) {
31-
count = getStringPermutationCount(prefix + s1.substring(i, i + 1), s1.substring(0, i) + s1.substring(i + 1), s2, count);
31+
count = getStringPermutationsCount(prefix + s1.substring(i, i + 1), s1.substring(0, i) + s1.substring(i + 1), s2, count);
3232
}
3333

3434
return count;
3535
}
3636

3737
public static void main(String a[]) {
38-
System.out.println(getStringPermutationCount("", "abc", "abcba", 0));
39-
System.out.println(getStringPermutationCount("", "abc", "abcbacb", 0));
38+
System.out.println(getStringPermutationsCount("", "abc", "abcba", 0));
39+
System.out.println(getStringPermutationsCount("", "abc", "abcbacb", 0));
4040
}
4141
}

0 commit comments

Comments
 (0)