Created
August 10, 2019 15:43
-
-
Save shharma-vipin/318674d0810213b9b53261fc43497dd4 to your computer and use it in GitHub Desktop.
Check if two Trees are identical
This file contains 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
private boolean checkIt(TreeNode A, TreeNode B){ | |
if(A == null && B == null) return true; | |
if(A == null || B == null) return false; | |
return (A.val == B.val && checkIt(A.left,B.left) && checkIt(A.right,B.right)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment