Recursive DFS code works well when written in a certain way but throws a TLE when I write the same recursion in the return statement

后端 未结 0 1084
别跟我提以往
别跟我提以往 2021-01-02 14:06

My code that works well to find the max depth:-

int maxDepth(struct TreeNode* root){
    int leftDepth = 0, rightDepth = 0;
    if (root == NULL)
        retu         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题