def find_minimum_depth(root):
if not root:
return -1
left, right = find_minimum_depth(root.left), find_minimum_depth(root.right)
if left >= right:
return left + 1
else:
return right + 1
Should we use queue for this question while we can do it with recursion? Can anybody explain the pros and cons considering the queue based solution?