Domanda di colloquio di Affirm

Create a dictionary with the methods add(), get() and delete() and deleteRandom(). The delete method needs to remove a random value from the dictionary every time the method is invoked. The deleteRandom() method should also adhere to constant time as opposed to O(n). i.e. it should not iterate over the entire list to get values in order to remove the random value.

Risposta di colloquio

Anonimo

1 mar 2020

I was able to answer the question for the most part except for the delete random implementation. I did not remember the class and the method off my head so had to juggle a bit. It seems the interviewer was not happy with it so they did not move forward further. The experience with the interviewer was fine and did not get much hints when I got stuck.