Graph Cycle Detection Leetcode