Bloomberg LP Interview Question
Financial Software DevelopersAs phone numbers are unique, we can use bitmap for representing them.
Assuming a phone number is of 10 digits, 10^10 numbers are possible (in fact many of these are invalid phone numbers. But, for simplicity, lets consider them too.)
So, we need, 10^10 bits to represent them. It's around 1 GB.
In first pass, we can set the corresponding bit to 1. And then in the second pass, read the array of bits and write them back to the file.
- Synonymous November 21, 2010