LeetCode-Feedback / LeetCode-Feedback

677 stars 334 forks source link

Missing Test Case - 110. Balanced Binary Tree #25453

Open akshitdahiya7 opened 5 days ago

akshitdahiya7 commented 5 days ago

LeetCode Username

akshitdahiya1621

Problem Number, Title, and Link

  1. Balanced Binary Tree https://leetcode.com/problems/balanced-binary-tree/

Bug Category

Missing test case (Incorrect/Inefficient Code getting accepted because of missing test cases)

Bug Description

[3,9,20,null,null,15,7]
[1,2,2,3,3,null,null,4,4]
[]

Language Used for Code

C++

Code used for Submit/Run operation

class Solution {
    int maxDepth(TreeNode* root) {
        if(root==NULL){
            return 0;
        }

        int leftheight=maxDepth(root->left);
        int rightheight=maxDepth(root->right);

        return 1+max(leftheight,rightheight);
    }
public:
    bool isBalanced(TreeNode* root) {
        if(root==NULL){
            return true;
        }
        int leftheight=maxDepth(root->left);
        int rightheight=maxDepth(root->right);
        if(abs(leftheight-rightheight)>=1){
            return false;
        }

return true;

    }
};

Expected behavior

System gave internal error and is unable to handle the case while it should have given the output as false because I am not checking the cases for all the subtrees.

Screenshots

No response

Additional context

No response

exalate-issue-sync[bot] commented 5 days ago

LeetCode Support commented: Hello,

Thank you for contributing to LeetCode and submitting a missing test case. Upon review, we found that your code indeed failed as expected. This may have resulted from a recent update where similar test cases were integrated into our system, which now accurately detects the issues in your submission.

If you would like to resubmit your code for further review or if you have any additional questions, please feel free to reply to this message or open a new issue with us.

Thank you for your engagement and for helping us improve our platform.

Best regards, LeetCode Support Team