time complexity is as good as BFS. space complexity is as good as DFS. Could you give me some suggestion on my code?Thanks!

```
public class Solution {
public int minDepth(TreeNode root) {
if(root==null) return 0;
return iterativeDeepeningDFS(root);
}
private boolean depthLimitedSearch(TreeNode root,int depth){
boolean left = false;
boolean right = false;
if(depth>0){
if(root.left==null&&root.right==null){
return true;
}
if(root.left!=null) {
left = depthLimitedSearch(root.left, depth-1);
}
if(root.right!=null) {
right = depthLimitedSearch(root.right, depth-1);
}
return left||right;
} else {
return false;
}
}
private int iterativeDeepeningDFS(TreeNode root){
int thisDepth = 1;
boolean foundMin = false;
while(true){
foundMin = depthLimitedSearch(root,thisDepth);
if(foundMin){
return thisDepth;
} else {
thisDepth++;
}
}
}
```

}