Two Amazon Interview Questions
February 26, 2016
In the previous exercise I wrote a solution that doesn’t work, so I guess I have to try again with two more Amazon interview questions:
Create a set data structure that provides the following operations, which must all operate in constant time: insert, delete, member?, and random. The random operation should return a random element from the set.
Given an array, find the first element that appears an even number of times.
Your task is to answer the two interview questions. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Pages: 1 2