Maximum Depth of a Binary Tree (Leetcode 104)

Technique: FAITH technique of Recursion

Problem Link 1: https://leetcode.com/problems/maximum-depth-of-binary-tree/

Problem Link 2: https://practice.geeksforgeeks.org/problems/height-of-binary-tree/1

class Solution:

    def height(self, root):
    
        if(root is None):
            return 0
        height=max(self.height(root.left), self.height(root.right)) + 1
        return height

Last updated