Ezvor

2737. Find the Closest Marked Node

MediumArray Preparing judge… LeetCode
ArrayGraph TheoryHeap (Priority Queue)Shortest Path

Hints

Hint 1
Find the distance from s to all nodes.
Hint 2
You can use Dijkstra to find them.
Hint 3
Find the minimum distance between marked nodes.