The complexity of the task about lists
Recently, a task slipped from an interview with Microsoft, about lists: a list is given to determine if it has a cycle.
Complicate. Given a list, determine if it has a cycle, and if so, how many elements in the cycle. At the same time, the list is muttable (that is, you can change it), but after completion, it is necessary that the list remains unchanged.
Complicate. Given a list, determine if it has a cycle, and if so, how many elements in the cycle. At the same time, the list is muttable (that is, you can change it), but after completion, it is necessary that the list remains unchanged.