Find the Missing NumbersFind the Missing Numbers
You have a bag containing tiles with numbers
[1, 2, 3, …, n] written on them. Each number appears exactly once, so there are
n tiles and
n numbers. Now, without looking,
k number tiles are randomly picked out of the bag and discarded. Create a
missing_nos() function that takes in a list and
k, and returns the missing numbers in ascending order (from smallest to greatest).
missing_nos([1, 2, 4, 5, 6, 7, 8, 10], 2) should return
This challenge was reported to have been asked at interviews with Twitter. If you’ve covered the material in Pass the Technical Interview with Python or an equivalent, you should be able to solve this challenge. If you have trouble, try refreshing your knowledge there first.