Sort an Array of 0s and 1s
Given an array consisting of only 0s and 1s, sort the array in ascending order (all 0s first, followed by all 1s).
The sorting must be done in-place without using built-in sort.
Example 1
Input: arr = 0, 1, 1, 0, 1, 0, 0, 1]
Output: [0, 0, 0, 0, 1, 1, 1, 1]
Example 2
Input: arr = [1, 1, 1, 0, 0, 0]...
~ HackFury
⏱️05 October 2025