package
0.0.0-20240615115840-a222ecda5fb5
Repository: https://github.com/koykov/algoexpert.io.git
Documentation: pkg.go.dev

# README

Missing Numbers

Category: Arrays

Difficulty: Medium

Description

You're given an unordered list of unique integers nums in the range [1, n], where n represents the length of nums + 2. This means that two numbers in this range are missing from the list.

Write a function that takes in this list and returns a new list with the two missing numbers, sorted numerically.

Sample Input

nums = [1, 4, 3]

Sample Output

[2, 5]  // n is 5, meaning the completed list should be [1, 2, 3, 4, 5]

Optimal Space & Time Complexity

O(n) time | O(1) space - where n is the length of the input array