Search⌘ K
AI Features

Shortest Cycle in a Graph

Shortest Cycle in a Graph gives an undirected graph as edges between labeled vertices. Return the length of its shortest cycle, or negative one when no cycle exists.

Statement

You are given a bidirectional graph with n vertices, labeled from 0 to n - 1. The graph is represented ...