Skip to content

Instantly share code, notes, and snippets.

View kaashmonee's full-sized avatar

Skanda Kaashyap kaashmonee

View GitHub Profile
@rioshen
rioshen / Backtrack.java
Created September 24, 2014 00:25
Backtracking Template
public class Backtrack {
public static List<List<Object>> backtrack(int[] A) {
// Set up a list of list to hold all possible solutions
List<List<Object>> result = new LinkedList<List<Object>>();
if (A == null || A.length == 0) {
return result;
}
// As we need to recursively generate every solution,
// a variable is needed to store single solution.