static void ListCombination(String str){
if(str != null && str.length()!=0)
RecCombine("",str);
}
static void RecCombine(String prefix,String rest){
if(rest.length() == 0)
System.out.print(prefix + " ");
else{
RecCombine(prefix + rest.charAt(0),rest.substring(1));
RecCombine(prefix,rest.substring(1));
}
}
Related Questions :
- You will also need to find out all substrings of a string in the subset sum problem http://www.geeksforgeeks.org/dynamic-programming-subset-sum-problem/
No comments:
Post a Comment