We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f6021b2 commit 8dab545Copy full SHA for 8dab545
LeetCode/Easy/0111-minimum-depth-of-binary-tree/0111-minimum-depth-of-binary-tree.java
@@ -38,15 +38,14 @@ public int minDepth(TreeNode root) {
38
39
while(!queue.isEmpty()){
40
int queueLen = queue.size();
41
+ minDepth++;
42
43
while(queueLen-->0){
44
TreeNode node = queue.poll();
45
if(node.left==null && node.right==null) return minDepth;
46
if(node.left!=null) queue.add(node.left);
47
if(node.right!=null) queue.add(node.right);
- }
48
-
49
- minDepth++;
+ }
50
}
51
52
return minDepth;
0 commit comments