you give direct graph n node number 0 n 1 node outgoing edgethe graph represent give 0indexed array edge size n indicate direct edge node node edgesi if outgoing edge node edgesi 1return length long cycle graph if cycle exist return 1A cycle path start end node Example 1input edge 33423output 3explanation the long cycle graph cycle 2 4 3 2the length cycle 3 3 returnedExample 2input edge 2131output 1explanation there cycle graph Constraintsn edgeslength2 n 1051 edgesi nedgesi