Group Colored Records Using Only Swaps

Asked at Snowflake · Coding Questions · Difficulty: Medium · Last asked Jun 25, 2026

A `RecordCollection` stores a sequence of records, and each record has a color: `0` (red), `1` (green) or `2` (blue). The records cannot be read or written directly; the collection exposes only a few methods. Rearrange the records in place so that all `0`s come first, then all `1`s, then all `2`s.

Loading the problem…