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

Решение

class Solution {
    fun isSymmetric(root: TreeNode?): Boolean {
        fun eq(a: TreeNode?, b: TreeNode?): Boolean {
            if (a === null || b === null) return a === b
            if (a.`val` != b.`val`) return false
            return eq(a.left, b.right) && eq(a.right, b.left)
        }
        return eq(root?.left, root?.right)
    }
}