Checking if a given list has a loop as well as find the starting point of the list