Given a linked list. Remove a cycle in it. If there is no cycle, do nothing.
Definition of a single linked list:
Implement a function removeCycle that assigns null to the next pointer of the tail and returns pointer to the head of the list.
Function removeCycle removes the pointer from the tail (sets the tail pointer next to null) and returns head: