code same as sir explained
code- https://ide.codingblocks.com/s/387525
Failing 1 test case
Can you give me link of this question where you are submitting this so that i can see if the changes i have applied in your code is right or not. Though i have done this change in your code. You can also check if this makes it accepted.
if(cnt1 >= (n/3)){//updated
ans.push_back(ele1);
}
if(cnt2 >= (n/3)){//updated
ans.push_back(ele2);
}
https://online.codingblocks.com/app/player/136675/content/132412/8760/code-challenge
still failing now 2 test case
Have made few changes in it, now see it it gets accepted as i don’t have access for your course so i can’t check the link you have provided. Though it must get accepted as have corrected the logic
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.