Separate All
CodeChefOpen on judge ↗
Sudhir uncle purchased three types of cold drinks. One for children, one for young people and one for old people but in the party hall, all the people are mixed together so it is difficult to serve the drinks. Consider the party hall as an array of integers, Children as 0, Young people as 1, and old people as 2. Segregate them in a manner so that all 0’s come first then all 1’s and then all 2’s.
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start