private static Node root;
private static Node temp;
private static int least = Integer.MAX_VALUE;
private static Node swapLeast(Node r) {
if (r.val < least) {
least = r.val;
temp = r;
}
if (r.left != null)
swapLeast(r.left);
if (r.right != null)
swapLeast(r.right);
temp.val = root.val;
root.val = least;
return root;
}