This is my code, but it does not pass all the test cases.Why?
Sorting in linear time
hello @ayushtiwari12
its time complexity is O(n^2) thats why it is not passing.
try to solve it in O(n)
hint -> in input u will only have 0,1 or 2
will you please make it correct in my code?
bro u need to change ur complete logic.
keep count of 0 , 1 and 2.
and then simply use tht counting to put that many of 0 in start then put 1 s and then 2
Thankyou, Now I got it.