i want to create vector v1 inside inorderTraversal function only and no othere separate function so how to do this and i have done this anyone please rectify it.
class Solution {
public:
vector<int> inorderTraversal(TreeNode* root) {
vector<int> v1;
if(!root) return v1;
inorderTraversal(root->left);
v1.push_back(root->val);
inorderTraversal(root->right);
return v1;
}
};