None of the test cases are getting passed
Hello @tusharnitharwal,
You can refer to the following video:
Also, the output should be in a sorted manner.
Hope, this would help.
my solution is almost similar
Hello @tusharnitharwal,
-
Missing Case:
//when there is no node:
if(v.size()==0)
cout<<“0”;
else{
sort(v.begin(),v.end());
for(int i=0;i<r;i++)
{
cout<<v[i]<<" ";
}
} -
No, the logic is not similar:
It failing for many test cases:
Example:
9
1 20 8 4 2 12 10 14 22
2 4 8 10 12 14 20 22 1
1
8 2
Expected Output:
1 2 10 14 22
Your Output:
1
You must see this code:
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.