https://leetcode.com/problems/same-tree/description/ Easy

Решение

class Solution {
    fun isSameTree(p: TreeNode?, q: TreeNode?): Boolean {
        if (p === null || q === null) return p === q
        if (p.`val` != q.`val`) return false
        return isSameTree(p.left, q.left) && isSameTree(p.right, q.right)
    }
}