Question on Leetcode - Easy
(high level summary)
The approach taken was to use two pointer method: one that takes account of the current value and the other to take the value ahead. Then I traversed through the linkedlist.
First, I use a while
loop to iterate over each node in the linked list. It will continue until the current variable reaches the end of the list (i.e., None). Inside this while
loop, another variable, temp
is initialized with the next node after the current node (curr). This temp variable is used to check for duplicate values.