Amazon Interview Question
Software Engineer / DevelopersHow about a writing a hash function which finds the range when given a input , in that manner we can have hash table with range as key and value as card type .
The Hash Function must take care of returning the range given the Integer value. we can retrieve the card type in this manner in 0(1) time.
A sorted array of 10,000 numbers where i th element represents starting range for the
- Anonymous June 25, 2010i th card.
Binary search in log n time can help us map a card number to its type