answer to -1.n to the length of edges.visit array to track visited nodes.i is unvisited, start DFS from i.node as visited.neighbor using edges[node].neighbor is unvisited, set dist[neighbor] and recurse with neighbor.neighbor is visited and present in dist, update answer with the cycle length.answer.