int maxDepth(TreeNode* root) { int maxDepth = 0; // Initialize the maximum depth int count = 0; // Initialize the current depth counter dfs(root, count, maxDepth); return maxDepth; } private: void dfs(TreeNode* node, int count, int &maxDepth) { if (node == NULL) return; count++; // Increment counter to reflect current depth if (count > maxDepth) { maxDepth = count; // Update maximum depth } dfs(node->left, count, maxDepth); dfs(node->right, count, maxDepth); } }; this code works but i cant understand how every recursion call maintain its own count variable