Dijkstra's Dutch national flag problem: rearrange a list in place, in one pass, so that every value below a pivot comes first, then values equal to it, then values above it.
Implement:
partition3(nums, pivot): rearrange nums in place using three pointers (low, mid, high) and return (lt, gt), where nums[:lt] are less than the pivot, nums[lt:gt] are equal and nums[gt:] are greatersort_colors(nums): sort a list containing only 0, 1 and 2 in place with one call to partition3