| 25 | Solution():cnt(0) {} |
| 26 | |
| 27 | int depth(TreeNode * root) { |
| 28 | if (root == NULL) return 0; |
| 29 | int l = depth(root->left), r = depth(root->right); |
| 30 | if (l + r > cnt) cnt = l + r; |
| 31 | return max(l, r) + 1; |
| 32 | } |
| 33 | |
| 34 | int diameterOfBinaryTree(TreeNode* root) { |
| 35 | depth(root); |
nothing calls this directly
no outgoing calls
no test coverage detected