Swfit solution. Any improvement?


  • 0
    E

    class Solution {
    func maxDepth(_ root: TreeNode?) -> Int {
    guard let node = root else {
    return 0
    }
    return 1 + max(maxDepth(node.left),maxDepth(node.right))
    }
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.