> For the complete documentation index, see [llms.txt](https://emmaguo100.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emmaguo100.gitbook.io/leetcode/01-19-2022-448.md).

# 01/19/2022 448

![](/files/EFVNrZd3i1VpLg2XviYe)

simply allocated a separate index for each number, then checked which indexes are zero - these are our numbers we are looking for.

Time O(n)

Space O(n)

![](/files/gVliDBC5wz9ejlEMpl0U)

method:\
use hashset to add each element into its set. Then loop through from i = 1 to n, if set doesn't contain i, add it into result.

Time O(n)

Space O(n)

Space in-place **Modification Solution**

We will be negating the numbers seen in the array and use the sign of each of the numbers for finding our missing numbers. We will be treating numbers in the array as indices and mark corresponding locations in the array as negative.

Time O(n)

Space O(**1**)

Although this method is very smart. It will modify the original array. You have to ask the interviewer if it is ok to do that. &#x20;
