Sorting linear time

is using counting sort equally good?

You need to use here the famous dutch national flag algorithm, that will sort the array containing only 0’s, 1’s and 2’s in O(N) time complexity, To understand more about this algo, you can refer to the hint video given…