private static void getPermutations(List<TreeNode> levelNodes, List<List<Integer>> lists, int k) {
        if(k==levelNodes.size()){
            List<Integer> list= new ArrayList<>();
            for (TreeNode levelNode : levelNodes) {
                list.add(levelNode.val);
            }
            lists.add(list);
            return;
        }
        for (int i = k; i <levelNodes.size(); i++) {

            TreeNode temp=levelNodes.get(i);
            levelNodes.set(i, levelNodes.get(k));
            levelNodes.set(k, temp);

            getPermutations(levelNodes, lists, k + 1);

            temp=levelNodes.get(i);
            levelNodes.set(i, levelNodes.get(k));
            levelNodes.set(k, temp);
        }
    }
Solution is simple. Do level order traversal in binary search tree, and for each level nodes get all
possible permutations to make new lists
src/problems/medium/BSTSequences.java