Different approach

Hi. I have tried a different approach where I am sorting all the elements first and then, at a[i] I am checking if a[i + n/3] is equal to a[i]. Sample testcase passed But when i submitted the testcases were failing. Where am i missing out on this logic?

Hey your logic is correct but the problem is with code output
Since actual solution is implemented using the solution in video so output files are according to it.
So it will not match your output order.

1 Like

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.