Given an array of three group of elements sort them in order
Input: [2,0,2,1,1,0]
Output: [0,0,1,1,2,2]
One Simple way is to use Counting Sort a...
For further actions, you may consider blocking this person and/or reporting abuse
I implemented these two methods exactly. First one has an extra space of O(n) and the other one is constant space O(1). Runtime of both functions is O(n). This problem is also called Dutch National Flag problem.