You are viewing a single comment's thread. Return to all comments →
go
func removeDuplicates(llist *SinglyLinkedListNode) *SinglyLinkedListNode { myMap := make(map[int32]int32)
dump := llist before := llist for (dump != nil) { _, exists := myMap[dump.data] if exists { before.next = dump.next dump = dump.next } else { myMap[dump.data] = 1 before = dump dump = dump.next } } return llist
}
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Delete duplicate-value nodes from a sorted linked list
You are viewing a single comment's thread. Return to all comments →
go
func removeDuplicates(llist *SinglyLinkedListNode) *SinglyLinkedListNode { myMap := make(map[int32]int32)
}