# Sort an Array Containing Only 0s, 1s, and 2s

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/972/sort-array-0s-1s-2s
Source observed: 2026-11-05T01:26:21.645Z
Last checked: 2026-11-05T01:26:21.645+00:00
Indexed: 2026-11-06T18:37:13.626+00:00

---

# Sort an Array Containing Only 0s, 1s, and 2s

We provide this coding interview question for practice. The task is to sort an array containing only **0s, 1s, and 2s**.

## Question details

- **Company:** [LinkedIn](https://www.aced.io/questions?company=linkedin)
- **Category:** [Data Structures & Algorithms](https://www.aced.io/questions?type=algorithms)
- **Additional categories:** [Coding](https://www.aced.io/questions?type=coding), [Technical](https://www.aced.io/questions?type=technical)
- **Interview count:** 1 interview
- **Reported last asked:** 5 years ago

## Answer access

Detailed company statistics are available through [Upgrade](https://www.aced.io/upgrade?src=questions). To answer, log in or sign up. Submitting marks the question complete.

## Community answers

No answers have been contributed by the community yet.

## Related questions

- [Sort an array containing zeros.](https://www.aced.io/questions/1116/sort-array-containing-zeros)

## Your answer

[All Questions](https://www.aced.io/questions) · [Log in or sign up to answer this question](https://www.aced.io/login?src=nav) · Submit your answer to mark the question complete.

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F972%2Fsort-array-0s-1s-2s&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F972%2Fsort-array-0s-1s-2s). Opening a form does not execute a tool.