Pls check the code it is not passing testcase 0
yeah!!but while submitting 0 testcase is not gettng passed no
Actually Sneha you are doing this question in a wrong way , in built sort function has complexity of NlogN , and you have to do it in order of N. Whereas you are returning whenever you encounter 2 , but you don’t have to do it. Go for an approach which solves this question in O(N) , and keep this in mind that you’ll be giving only 0,1&2 in array no other then that. If you still not able to find out, I’ll provide you with my code 
can u brief what does linear complexity mean
Why not? Linear complexity means that you only have to iterate only single time on every element of an array. More naively, only sort it using single for loop.
still same problem…i tried using one loop only
Okay @sneha23 implementation you applied is wrong. But you tried I am happy for that. Now I can provide you with code, so listen. I will send you a code with video explanation, please watch them
Video: https://youtu.be/sEQk8xgjx64
Code: https://ide.codingblocks.com/s/345889
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.