17 lines
320 B
C
17 lines
320 B
C
#include "include/TreeNode.h"
|
|
#include <math.h>
|
|
|
|
int minDepth(struct TreeNode *root)
|
|
{
|
|
if (!root)
|
|
return 0;
|
|
if (!root->left || !root->right)
|
|
return minDepth(root->left) + minDepth(root->right) + 1;
|
|
return fmin(minDepth(root->left), minDepth(root->right)) + 1;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
return 0;
|
|
}
|