Available question text
Given an undirected tree (or graph) where nodes can be toggled "marked," support operations that mark/unmark nodes and queries that ask for the shortest distance from a given node to the nearest marked node. The challenge is to answer many dynamic distance queries efficiently (better than recomputing BFS from scratch), typically requiring multi-source shortest-path ideas or tree decomposition/centroid techniques.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
DoorDash
Leetcode 2737. Find the Closest Marked Node
Reported Mar 9, 2026 · 1 source report
STAFF
Source snapshot: Nov 12, 2026
View source