Pergunta de entrevista da empresa SAP

They asked me to implement a function to detect cycles in a graph. I explained the DFS approach using recursion and visited arrays, and then coded the solution with proper edge case handling.