ION Group Interview Question

GFG puzzle, Linked loop and how to remove it