Implement concurrent structures and debug queue code
MicrosoftSoftware Engineer · Technical ScreenLast updated
This question evaluates data-structure implementation and concurrent programming competencies by testing construction of an LRU cache, a custom hash map, a quadtree spatial index, and debugging of a producer-consumer queue.
The coding rounds covered several implementation and debugging tasks:
- Implement an LRU cache that supports
get(key)andput(key, value)in constant time. Then explain how you would make the cache safe under concurrent access from multiple threads. - Implement a hash map from scratch with
put,get, andremove. Then discuss or extend the design so that it works correctly when multiple threads read and write concurrently. - Implement a quadtree for two-dimensional points or rectangles, and support spatial query operations such as returning all items inside a query rectangle.
- Review and debug a C++20 producer-consumer program built around a message queue. Identify correctness issues, race conditions, synchronization mistakes, and any performance or API-design problems.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.