Another approach

Why am i TLE if i am detecting the dependency using cycle detection approach?

hello @rohangupta569
yeah ur approach is correct.
if cycle present then no otherwise yes.

u might have done some implementation mistake.
pls share ur code with me using cb ide , i will check