My code that works well to find the max depth:-
int maxDepth(struct TreeNode* root){ int leftDepth = 0, rightDepth = 0; if (root == NULL) retu