Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
primaryobjects / binaryTree-max-depth.js
Created March 24, 2017 21:40
Finding the maximum depth of a binary tree in JavaScript.
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {number}