The maximum depth (104) of the binary tree Leetcode

Subject description:

Problem-solving ideas:

Code:

public int MaxDepth(TreeNode root) { if (root == null) return 0; return Mathf.Max(MaxDepth(root.left) + 1, MaxDepth(root.right) + 1); }
Source: http://www.1994july.club/

Guess you like

Origin www.cnblogs.com/1994july/p/12148847.html