Cycle detection and removal


it shows wrong output for some test cases

hello @naazsayma123
image
u r not removing cyle after its detection.
pls add code for the same and then try