MicrosoftCoding·45 minMembers
Distance from Each Node to the Cycle in an Undirected Graph
Members only
Given an undirected graph that contains exactly one cycle, return for every node its shortest distance to any node on the cycle. Cycle nodes return 0.
SWE
graph
bfs
topological-sort
hard
Frequency
Single report
Last asked
2026-01-16
Stage
onsite-coding
Log in to continue reading the full content
Comments
Sign in to join the discussion
Loading...
