[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"searchBlogPosts":3,"$fUeQ31FryG7VpVHL3nz9QWX_1EKZoZZGY-Idnhn_PVf0":7},[4],{"_path":5,"title":6},"\u002Fblog\u002F2023\u002F09\u002F17\u002Fspring-boot-postgresql","Spring Boot with PostgreSQL & pgAdmin in Docker",{"title":8,"category":9,"problemHtml":10,"solutions":11,"repoUrl":16},"Depth Of Binary Tree","Data Structures & Algorithms","",[12],{"lang":13,"label":14,"html":15},"python","Python","\u003Cpre>\u003Ccode class=\"language-python\"># Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\n\nclass Solution:\n    def maxDepth(self, root: Optional[TreeNode]) -&gt; int:\n\n        que = deque()\n        if root:\n            que.append(root)\n        depth = 0\n\n        while que:\n            for i in range(len(que)):\n                node = que.popleft()\n                if node.left:\n                    que.append(node.left)\n                if node.right:\n                    que.append(node.right)\n\n            depth += 1\n\n        \n        return depth\u003C\u002Fcode>\u003C\u002Fpre>","https:\u002F\u002Fgithub.com\u002Fvishwarajsali\u002FInterviewPrep\u002Ftree\u002Fmain\u002FData%20Structures%20%26%20Algorithms%2Fdepth-of-binary-tree"]