Problems > Sort the Flag > Editorial

Sort the Flag — Solution & Editorial

Back to the Problem

Three-way partition with low/mid/high pointers, or simply count the three values and re-emit — both are O(N).

Complexity: O(N)