Skip to content

Instantly share code, notes, and snippets.

@vicxruiz
Last active February 26, 2020 16:23
Show Gist options
  • Save vicxruiz/7092b10287b10d4fde16efdf1a2e4c93 to your computer and use it in GitHub Desktop.
Save vicxruiz/7092b10287b10d4fde16efdf1a2e4c93 to your computer and use it in GitHub Desktop.
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
Find all the elements of [1, n] inclusive that do not appear in this array.
Example:
Input:
[4,3,2,7,8,2,3,1]
Output:
[5,6]
func findDisappearedNumbers(_ nums: [Int]) -> [Int] {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment