Cover image for Wargaming
Logo

Wargaming

Engaged Employer

Wargaming

Add an Interview

Interview Question

Software Engineer Interview

-

Wargaming

How would you store a collection of numbers so that getting the minimum number is O(1) and inserting new numbers is extremely efficient?

Interview Answer

1 Answer

0

Use a minheap. Then retrieval is O(1) and insertion is at most O(log (height of heap))

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.