class Solution {
public:
int findTargetNode(TreeNode* root, int cnt) {
vector<int> v;
push1(v,root);
return v[cnt-1];
}
void push1(vector<int> &v,TreeNode *root)
{
if(root)
{
push1(v,root->right);
v.push_back(root->val);
push1(v,root->left);
}
}
};
leetcode每日一题第七十六天
最新推荐文章于 2024-07-12 21:04:18 发布