(TreeNode p, TreeNode q)
| 25 | |
| 26 | class Solution { |
| 27 | public boolean isSameTree(TreeNode p, TreeNode q) { |
| 28 | // p and q are both null |
| 29 | if (p == null && q == null) return true; |
| 30 | // one of p and q is null |
| 31 | if (q == null || p == null) return false; |
| 32 | if (p.val != q.val) return false; |
| 33 | return isSameTree(p.right, q.right) && |
| 34 | isSameTree(p.left, q.left); |
| 35 | } |
| 36 | } |
nothing calls this directly
no outgoing calls
no test coverage detected