Easy, use hash table to store previous node, check if current node already in the hash table.

Error:
N/A