LinkedIn·Software Engineer·Onsite - Coding / Algorithms
- You're given a buggy priority queue implementation. Find and fix all the bugs, including heap property violations, comparator misuse, off-by-one errors in sift-up and sift-down, and edge cases for empty or single-element heaps.
- Implement a thread-safe concurrent queue to back a web crawler, supporting multiple producer threads enqueuing URLs and multiple consumer threads dequeuing them, with proper blocking behavior, graceful shutdown, and no busy-waiting.
“The off-by-one in sift-down got me.”