Problems

Circular Import Detector

HardModules

Given the same module→imports JSON graph, print cycle if any circular import exists, otherwise ok.

Input: one JSON object. Output: cycle or ok.

Your program reads from stdin and prints to stdout.

Example 1

Input: {"a":["b"],"b":["a"]}

Output: cycle

Hints

JavaScriptModulesGraphs