var maxDepth = function (root) {
let max = 0;
const traversal = (node, count = 0) => {
if (node === null) return;
count++;
if (count > max) max = count;
if (node?.left) traversal(node.left, count);
if (node?.right) traversal(node.right, count);
};
traversal(root);
return max;
};