Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.thealgorithms.dynamicprogramming;

public class ArrayList<T> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.thealgorithms.dynamicprogramming;
import java.util.ArrayList;
public class subsetRecursion {
public static void subset(String prefix, String str, ArrayList<String> result) {
// Base case: if the string is empty, add the prefix to the result
if (str.isEmpty()) {
result.add(prefix);
return;
}
// Recursive call by including the first character in the prefix
subset(prefix + str.charAt(0), str.substring(1), result);

// Recursive call by excluding the first character
subset(prefix, str.substring(1), result);

}
}
Loading