Solution for inOrder