Created
March 13, 2023 06:28
-
-
Save Khamies/04238f43fa290633e087bf32b37e8c2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def is_symmetric_BT(root): | |
| def check(left, right): | |
| if not left and not right: | |
| return True | |
| if not left or not right: | |
| return False | |
| if left.val != right.val: | |
| return False | |
| return check(left.left, right.right) and check(left.right, right.left) | |
| return check(root.left, root.right) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment