solution to Minimum Depth of Binary Tree