Microsoft Interview Question
Software Engineer / Developersa) Take hash of shuffle card values and stored it into hash table
b) is hash of current hash_value is in the hash table then collision.
while(count < MAX_THRESHOLD)
{
hash_key = sha256_hash_of(get_shuffle());
if( is_present_in_the_hashtable(hash_key)) {
++collision;
print collision, count - hashtable.getcount(count);
} else {
hashtable.insert(hash_key, count);
}
}
1.) 52 cards
- yeah December 01, 20082.) 23 cards
3.) 56 cards
4.) some cards turned upside down
5.) repeating cards (of same suite & same value)