I thinks the 2nd idea is simple as similar to early solution: use a hashmap to have key(node addr), if the addr is duplicate, it means there is a loop.
Ch2-5: find the beginning of loop in a circular linked list---two solutions
Given a circular linked list, implement an algorithm which returns node at the beginning of the loop.DEFINITIONCircular linked list: A (corrupt) linked list in which a node’s next pointer poin