Solving Linked List Cycle
To see the question, click here.
Naive Approach
The idea is to use a HashSet to keep track of the nodes we've visited. We know there is a cycle if we encounter a node we've already seen.
// TC: O(n)
// SC: O(n)
import java.util.HashSet;
class ListN...
vineethchivukula.hashnode.dev4 min read