Skip to content

Instantly share code, notes, and snippets.

View Julie728's full-sized avatar

Jun Liu Julie728

  • University of Pittsburgh
  • Pittsburgh
View GitHub Profile
@Julie728
Julie728 / Solution.java
Created June 24, 2014 00:38
CareerCup 2.1 Write code to remove duplicates from an unsorted linked list. FOLLOW UP How would you solve this problem if a temporary buffer is not allowed?
import java.util.HashSet;
public class Solution {
public static void deleteDuplicates_HashSet(Node head){
HashSet<Integer> nodeSet = new HashSet<Integer>();
Node prev = null;
while(head != null){