Skip to content

Instantly share code, notes, and snippets.

@shharma-vipin
Created August 10, 2019 15:43
Show Gist options
  • Save shharma-vipin/318674d0810213b9b53261fc43497dd4 to your computer and use it in GitHub Desktop.
Save shharma-vipin/318674d0810213b9b53261fc43497dd4 to your computer and use it in GitHub Desktop.
Check if two Trees are identical
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