Microsoft Interview Question

Generate a list of prime numbers efficiently.

Interview Answer

Anonymous

Jul 12, 2020

Given an array that have every number from 1 to 10^6, we randomly erase two of them. How can we find those missing numbers? (Without using any other extra data structure, that is, in constant memory complexity)