/* The Node structure is struct Node { int data; Node* left; Node* right; }; */
classSolution{ public: /*You are required to complete this method*/ intminDepth(Node *root, int dep = 1){ if(!root->left and !root->right) return dep; int res = INT_MAX; if(root->left) res = min(res, minDepth(root->left, dep + 1)); if(root->right) res = min(res, minDepth(root->right, dep + 1)); return res; } };