Mavenclinic·Backend Engineer·Technical Phone Screen
- Build a function that paginates a pre-sorted list of telehealth provider listings into pages of size 5, ensuring at most one listing per provider per page when possible, preserving original order, and allowing provider repeats only when needed to fill a page.
- What is the time and space complexity of your pagination algorithm?
- How would you modify the algorithm if high-scoring providers were allowed to appear more than once on the same page?
- How would you implement a memory-efficient streaming version of this algorithm for roughly 150 million listings that don't fit in memory?
“The core logic isn't hard to describe but I fumbled the implementation a bit.”