Given an array of unsorted integers, determine which number appears most often.
Anonymous
The ideal solution, and the one I discussed with the interviewer was: Make a hash table. Run through the array and for each number, if the location in the hash table is empty, add 1, and if the location is taken, increment the count in that bucket. Once you've run through the entire array, simply determine which bucket has the largest number, and that's your most common number (as well as how many times it appeared).
Check out your Company Bowl for anonymous work chats.