Given an array containing only 1 and 2, sort it in place without using any extra space.
Unlock detailed company stats for this questionUpgrade
Follow-up: extend to an array containing 1, 2 and 3, still in place with constant extra space (Dutch national flag).
Expect follow-ups like
- Extend the solution to handle an array containing 1, 2, and 3, again in place without extra space.
Format · 60-minute HackerRank coding round.
Community answers
No answers contributed by the community yet.
Related questions
Sort an array containing only 0s, 1s, and 2s.Given an integer array containing 1s and 2s, move all 1s to the start and all 2s to the end, in place.Related courses

Course

Course
Course
