
算法
Java
Leetcode
Java
Leetcode
Question
Given a sorted linked list, delete all duplicates such that each element appear only once.
See it on Leetcode
|
|
Hint
This is a simple problem that merely tests your ability to manipulate list node pointers. Because the input list is sorted, we can determine if a node is a duplicate by comparing its value to the node after it in the list. If it is a duplicate, we change the next pointer of the current node so that it skips the
nextnode and points directly to the one after the next node.
Solution
- java
- cpp
1 |
|




近期评论