Remove duplicate copies of a number from unsorted linked list

def remove_dup(self,head):   curr = head 
while(curr):
runner=curr
while(runner.next):
if runner.next.data==curr.data:
runner.next=runner.next.next
else:
runner=runner.next
curr=curr.next return head
def remove_dup(self,head):  curr = head 
while(curr):
if curr.data in hash_set:
prev.next=curr.next
else:
hash_set.add(curr.data)
prev=curr
curr=curr.next
return head

--

--

--

Tech-Enthusiast, Coder,Explorer,Geeky,Software Engineer |A piece of code delivers everything that you need. The world is all about codes.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to change the default styling of a radio button?

Helm 3: Top Five Improvements

Cutting the Cord Part 2 — TV Antennas

Better unit tests with Parameterized testing

50 Most Successful Images in 2017

Where is my Order ?

How to design Powerful APIs via Nolan’s The Prestige !

[EVENT] Delio ‘BTC 7 Day Deposit’ Open

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dhanarajappu

Dhanarajappu

Tech-Enthusiast, Coder,Explorer,Geeky,Software Engineer |A piece of code delivers everything that you need. The world is all about codes.

More from Medium

Binary Tree (DFS application)

Leetcode 455. Assign Cookies

Leetcode — Isomorphic Strings — Easy