Given a list of 4 billion integers, find an integer not in the list using 4MB of memory. (interview was in Java)
My solution is to use a BitSet.
However according to my calculations there aren't enough bits in 4 MB of memory! = c
4 Megabytes = 4096 KB # multiply by 8
4096 KB =~ 4,096,000 Bytes # multiply by 1000
4,096,000 Bytes =~ 33,500,000 bits # multiply by 8
So 33,500,000 bits is two orders of magnitude less than a billion. Let a lone the 4 billion.
Or is it part of the question to work with this limitation?