Back to problems

Escape Room

Object-Oriented Programming · Pinterest · Medium

Heap-Based Ordering with Lazy Deletion The core challenge is to answer “who are the k furthest‑progressed players?” efficiently even as players advance. Progress has two dimensions: the room number (higher is better) and, for tie‑breaking, the moment they entered that room. We need to rank participants so that later‑arrived equal‑room players come after earlier ones. A max‑heap can enforce exactly this ordering, provided we push a fresh record every time a player moves and…

Checking your access…