I am not able to pass test cases can you please let me know where i m getting wrong
Cycle detection and removal problem
still many test cases are not passing
where u r submitting?
this part has some issue.

change to this ->

ur updated code ->
