Code not working, please help

https://practice.geeksforgeeks.org/problems/inorder-traversal/1#

your code will not work for multiple testcase
after one testcase you should have to clear the vector for next testcase

Correct Code

vector<int>v;
void InorderHelper(Node *root){
    if(root==NULL){
        return;
    }
    InorderHelper(root->left);
    v.push_back(root->data);
    InorderHelper(root->right);
    
}
vector<int> inOrder(Node* root)
{
  // Your code here
  v.clear();
  InorderHelper(root);
  return v;
}

Thank You. Please help me close this thread by sending the rating link.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.