Stack Exchange network consists of 178 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
View all activity pages
Since the set of colours is known in advance, then:
Assign a number to each colour
Assign a leader
The leader arranges everyone else in numerical order, then stands at the end of the line
The leader ...