Sabhi test cases pr answer wrong kyu de raha hai

#include <bits/stdc++.h>

using namespace std;

void solve(int i, int n,vector<int> &v)
{

    if(i>n) return; 
    v.push_back(i); 

    for(int j=0;j<=9;j++)
    {
        solve(i*10+j,n,v); 
    }
}
vector<int> lexicalOrder(int n) {
    vector<int> ans;
    for(int i=1;i<10;i++){
        solve(i,n,ans); 
    }
    return ans;
}

int main()
{
int n;
cin>>n;

vectorv = lexicalOrder(n) ;
for(auto x:v)
{
cout<<x<<" ";
}
return 0;
}

hi @tarunkumar08yadav maybe some test case issue try, code looks good

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.