https://leetcode.com/problems/maximum-depth-of-binary-tree Easy

Решение

class Solution {
    fun maxDepth(root: TreeNode?): Int {
        if (root == null) return 0
        val l = maxDepth(root.left)
        val r = maxDepth(root.right)
        return if (l > r) l + 1 else r + 1
    }
}