Write a function to go through an array and count how many numbers are repeated and return this number.
Anonymous
The other answer sort of works, but is absurdly inefficient and would probably lose you points. Iterate over each element in the array and check/store against a hash table. If the element is not present, insert it with the integer as the key and "false" as the value. If the element is present, and the value is "false," increment a counter and set the value to "true." If the element is present and the value is "true," do nothing.
Check out your Company Bowl for anonymous work chats.