Day 2 - Arrays and Strings
Arrays
Practice Questions
Sort an Array without using Sorting Algorithm

Sort an array of 0s, 1s and 2s without using any sorting algorithm

Description

  • Given an array A of size N containing only 0s, 1s, and 2s; sort the array in ascending order.

Constraints

  • 1 <= N <= 10^6
  • 0 <= A[i] <= 2

Code