Given an array containing zeroes, ones and twos only. Write a function to sort the given array in O(n) time complexity.
One way to sort an array containing zeroes, ones, and twos in O(n) time complexity is by using a variation of the counting sort algorithm. The idea is to count the number of zeroes, ones, and twos in the array, and then use that information to recons...
shohanur.hashnode.dev2 min read