movePointer method

TreeNode movePointer (TreeNode root, int level)

Move the pointer to required tree level.

Implementation

static TreeNode movePointer(TreeNode root, int level) {
  if (level == 0) return root;
  return movePointer(root.children[root.children.length - 1], level - 1);
}