Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Leetcode-oneStop.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ public boolean isSymmetricRecursive(TreeNode root)

private boolean helperRecursive(TreeNode x, TreeNode y)
{
if (x == null || y == null) // Base Case: Both or one is null, so true
if (x == null && y == null) // Base Case: Both are null, so true
return true;
if (x == null || y == null) // Base Case: Passing above, here if any one is null, so false
return false;
return (x.val == y.val && helperRecursive(x.left, y.right) && helperRecursive(x.right, y.left));
// Check if values match and 1.left matches with the 2.right and 1.right matches with 2.left
}
Expand Down