LinkedIn interview question

Object and array - answer is to use hashmap. Similar to two sum