straightforward backtracking solution to partition