Skip to content

Commit f1868d9

Browse files
author
Ram swaroop
committed
added comments
1 parent 12e08af commit f1868d9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/me/ramswaroop/strings/StringPermutationCount.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,19 @@
99
* @author: ramswaroop
1010
* @date: 10/15/15
1111
* @time: 10:32 AM
12+
* @see: me.ramswaroop.strings.StringPermutations for a simpler version
1213
*/
1314
public class StringPermutationCount {
1415

16+
/**
17+
* Finds the number of permutations of string {@param s1} that exists in string {@param s2}.
18+
*
19+
* @param prefix
20+
* @param s1
21+
* @param s2
22+
* @param count
23+
* @return
24+
*/
1525
public static int getStringPermutationCount(String prefix, String s1, String s2, int count) {
1626
if (s1.isEmpty()) {
1727
if (s2.indexOf(prefix) != -1) count++;
@@ -26,6 +36,6 @@ public static int getStringPermutationCount(String prefix, String s1, String s2,
2636

2737
public static void main(String a[]) {
2838
System.out.println(getStringPermutationCount("", "abc", "abcba", 0));
29-
System.out.println(getStringPermutationCount("", "abc", "abcba", 0));
39+
System.out.println(getStringPermutationCount("", "abc", "abcbacb", 0));
3040
}
3141
}

src/me/ramswaroop/strings/StringPermutations.java

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @time: 2:27 PM
99
* @see: http://www.ericleschinski.com/c/java_permutations_recursion/
1010
* @see: http://introcs.cs.princeton.edu/java/23recursion/Permutations.java.html
11+
* @see: me.ramswaroop.strings.StringPermutationCount for a modification of this problem
1112
*/
1213
public class StringPermutations {
1314

0 commit comments

Comments
 (0)