How would you find if there is a loop in a linked list?
Represent the linked list with values and pos: node i points to node i + 1, except the final node points to node pos; pos = -1 means it points to None. Implement has_cycle(values, pos) and return True if the structure contains a cycle, otherwise return False. The function must use constant extra space and must not modify the input.
def has_cycle(values, pos):