---
title: "Comment by Lee Carver on \"Mastering LeetCode's \"Maximum Depth of Binary Tree\": A Comprehensive Guide\" | Hashnode"
description: "Although tree traversal is a powerful algorithm, this representation seems to offer an alternative implementation. If we know the index of the last non-null val"
url: "https://hashnode.com/posts/mastering-leetcodes-maximum-depth-of-binary-tree-a-comprehensive-guide/6605ac745f0c3008ce14f7dd/comment/6609b4882ec1a8de0e2ce6fb"
---

[Discussion](https://hashnode.com/posts/mastering-leetcodes-maximum-depth-of-binary-tree-a-comprehensive-guide/6605ac745f0c3008ce14f7dd)

Comment [Mastering LeetCode's "Maximum Depth of Binary Tree": A Comprehensive Guide](https://hashnode.com/posts/mastering-leetcodes-maximum-depth-of-binary-tree-a-comprehensive-guide/6605ac745f0c3008ce14f7dd)

[Lee Carver](https://hashnode.com/@leeca)

[Mar 31, 2024](https://hashnode.com/posts/mastering-leetcodes-maximum-depth-of-binary-tree-a-comprehensive-guide/6605ac745f0c3008ce14f7dd/comment/6609b4882ec1a8de0e2ce6fb)

Although tree traversal is a powerful algorithm, this representation seems to offer an alternative implementation. If we know the index of the last non-null value (approx. lastItem = root.length), would something like Math.log(last item) / Math.log(2) be correct? +-1?
