ByteDance Interview Question

find cycle in a directed graph