Search
⌘K
Get Premium
Leetcode 2608. Shortest Cycle in a Graph
Find the graph's girth: given an undirected simple graph, return the length (number of edges) of the shortest cycle or -1 if none exists. With n,m ≤ 1000, this is typically solved by repeated BFS/shortest-path searches on the unweighted graph to detect the minimal closed loop.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.