# Find the Smallest Missing Integer — Aced

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/3060/find-smallest-missing-integer
Source observed: 2026-11-05T00:28:12.385Z
Last checked: 2026-11-05T00:28:12.385+00:00
Indexed: 2026-11-07T02:09:41.288+00:00

---

# Find the Smallest Missing Integer

**Difficulty:** Easy  
**Category:** [Data Structures & Algorithms](https://www.aced.io/questions?type=algorithms) · [Coding](https://www.aced.io/questions?type=coding)

Aced (formerly Exponent) provides interview-preparation courses, practice, and coding questions. This question asks you to implement `getDifferentNumber` for an array of unique nonnegative integers.

## Problem

Given an array `arr` of unique nonnegative integers, implement a function `getDifferentNumber` that finds the smallest nonnegative integer that is **not** in the array.

Assume the maximum representable integer is `MAX_INT = 2^31-1`, even in languages such as Python that otherwise support larger integers. The operation `MAX_INT + 1` is therefore undefined for this problem.

## Requirements

1. First solve the problem without modifying the input array `arr`.
2. If time permits, develop an algorithm with improved space complexity that is allowed to modify `arr`.
3. Do not trade away time complexity when improving space complexity.
4. Analyze the time and space complexity of your algorithm.

## Example

```text
input:  arr = [0, 2, 1, 3, 5]
output: 4
```

## Interview and practice controls

The interface labels this as an interview question and shows “Reported last asked: 3 years ago.” Hints 1–6 and Challenges 1–2 are available as expandable controls. The solution and community tabs are separate from the question tab; no solution is included in the supplied content, and the page reports no community answers contributed yet.

Code execution is available after [signing up](https://www.aced.io/signup?src=lesson). Detailed company statistics for the question require [upgrading](https://www.aced.io/upgrade?src=questions).

## Related questions

- [Find the smallest missing element from a sorted array.](https://www.aced.io/questions/1165/smallest-missing-element-sorted-array)
- [Find the Largest Smaller BST Key](https://www.aced.io/questions/3059/find-largest-smaller-bst-key)
- [Find the K'th smallest element in an array.](https://www.aced.io/questions/1137/find-ktth-smallest-element-in-array)

## Other Aced interview-preparation areas

We offer courses and practice across these areas:

- [Product Management](https://www.aced.io/courses/pm?src=nav) — Ace product interviews from strategy cases to technical skills.
- [Forward Deployed](https://www.aced.io/courses/forward-deployed-engineering?src=nav) — Beta preparation for FDE loops at Anthropic, OpenAI, Palantir, and more.
- [Engineering Management](https://www.aced.io/courses/engineering-management?src=nav) — Review leadership and people-management skills.
- [Software Engineering](https://www.aced.io/courses/software-engineering?src=nav) — Learn strategies for coding problems and more.
- [System Design](https://www.aced.io/courses/system-design-interviews?src=nav) — Define architectures, interfaces, and databases in a time crunch.
- [Data Science](https://www.aced.io/courses/data-science?src=nav) — Execute statistical techniques and experimentation effectively.
- [Machine Learning](https://www.aced.io/courses/ml-engineer?src=nav) — Review building, evaluating, and deploying AI/ML models.
- [Data Engineering](https://www.aced.io/courses/data-engineering?src=nav) — Design complex data models and ETL pipelines.
- [AI Engineering](https://www.aced.io/courses/ai-engineering?src=nav)
- [Investment Banking](https://www.aced.io/ib?src=nav)
- [Generative AI](https://www.aced.io/courses/gen-ai-interviews?src=nav)
- [Security Engineer](https://www.aced.io/courses/security-engineer?src=nav)
- [TPM](https://www.aced.io/courses/tpm?src=nav)
- [Solutions Architect](https://www.aced.io/courses/solution-architect-interview?src=nav)
- [UX / Product Design](https://www.aced.io/courses/product-designer-interview?src=nav)
- [BizOps & Strategy](https://www.aced.io/courses/bizops?src=nav)
- [View all courses](https://www.aced.io/courses?src=nav)

Other areas include [Loops](https://www.aced.io/guides?src=nav), [Experiences](https://www.aced.io/experiences?src=nav), and [Practice](https://www.aced.io/practice?src=nav). We also provide [coaching](https://www.aced.io/coaching?src=nav), [resume review](https://www.aced.io/resume?src=nav), [salary negotiation](https://www.aced.io/coaching?category=negotiation&src=nav), [job referrals](https://www.aced.io/jobs/referrals?src=nav), and [pricing and upgrade information](https://www.aced.io/upgrade?src=nav).

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3060%2Ffind-smallest-missing-integer&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%2F3060%2Ffind-smallest-missing-integer). Opening a form does not execute a tool.