private List<TreeNode> helper(int head, int tail) {

    List<TreeNode> rst = new ArrayList<TreeNode>();

    if (head > tail) {
      rst.add(null);
      return rst;
    }


    for (int i = head ; i <= tail ; i++) {

      List<TreeNode> leftNodes = helper(head, i - 1);
      List<TreeNode> rightNodes = helper(i + 1, tail);

      for (TreeNode left : leftNodes) {
        for (TreeNode right : rightNodes) {

          TreeNode root = new TreeNode(i);
          root.left = left;
          root.right = right;
          rst.add(root);
        }
      }
    }

    return rst;
  }