slow answer


  • 0
    H

    class Solution {
    public:
    bool isSymmetric(TreeNode* root) {
    if(!root) return true;
    return judge(root->left,root->right);

    }
    bool judge(TreeNode* l, TreeNode* r){
        return (!l||!r) ?l==r: l->val==r->val&&judge(l->right,r->left)&&judge(l->left,r->right);
        }
    

    };
    pretty slow ,only beat 5.06%people


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.