Sort Colors

Sorting ยท medium

Given `arr` containing only `0`, `1`, and `2`, implement `sortColors(arr)` to sort it ascending in one pass (Dutch national flag). Return the array.

Learning resources

Loading...

Run your code to see results.