Course · Section 11: Working With Arrays · Lecture 172: Sorting Arrays
Given `arr` containing only `0`, `1`, and `2`, implement `sortColors(arr)` to sort it ascending in one pass (Dutch national flag). Return the array.
+ 1 hidden test run on Submit.
The Dutch national flag scan sorts three values in a single O(n) pass, O(1) space.
Run your code to see results.