Solve BinaryTreeConnectLeaves.