Implement a method to generate all possible combinations given a string input.
The method has other parameters:
StringBuffer outstr = new StringBuffer(); Listarr = new ArrayList (); int index: is start index : 0;
combine("abc",out,0,arr) --> {a,ab,abc,ac,b,bc,c}
Character
at each step.
Each loop iteration proceeds as follows:
1. Append a Character
2. Print the result
3. Perform a recursive invocation at the level i+1
4. Remove the Character
we added at step 1.
public static List<String> combine(String instr, StringBuffer outstr, int index, List<String> arr) { }
C
Java
Python