Pergunta de entrevista da empresa Peloton Interactive

Implement a list-based data structure that performs inserts and deletes in constant time.

Resposta da entrevista

Sigiloso

24 de mai. de 2023

Use a list to store the items, use a dictionary to store the indices of each item in the list. Perform deletes by swapping the item at the end for the item to be deleted, and then truncating the list by 1 item.