Sorting an array is a tedious task and usually takes nlogn time. But since we know that the array contains only 0s, 1s and 2s. We can do this sorting in logn time. Simple Approach One simple approach would be to find the frequency of each element(i.e...

Markdown supported · ⌘↵ to post
No responses yet.