Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3131175

Browse files
Merge pull request doocs#232 from ElectricBubble/master
Add Solution.go for 0083.Remove Duplicates from Sorted List
2 parents 8b6e7f9 + b557880 commit 3131175

File tree

1 file changed

+11
-0
lines changed
  • solution/0083.Remove Duplicates from Sorted List

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
func deleteDuplicates(head *ListNode) *ListNode {
2+
current := head
3+
for current != nil && current.Next != nil {
4+
if current.Val == current.Next.Val {
5+
current.Next = current.Next.Next
6+
} else {
7+
current = current.Next
8+
}
9+
}
10+
return head
11+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /