Skip to content

Instantly share code, notes, and snippets.

@maxfunke
Created May 9, 2014 09:05
Show Gist options
  • Save maxfunke/3fd53ff731fb644c6724 to your computer and use it in GitHub Desktop.
Save maxfunke/3fd53ff731fb644c6724 to your computer and use it in GitHub Desktop.
recursiv subset (different length, same order)
private static void recSubsets(String soFar, String rest) {
if (rest.equals("")) {
System.out.println(soFar);
} else {
recSubsets(soFar + rest.charAt(0), rest.substring(1));
recSubsets(soFar, rest.substring(1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment