LeetCode 203: Remove Linked List Elements
Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6
, val = 6. Return: 1 --> 2 --> 3 --> 4 --> 5
.
思路
两个指针, 一样的就删, 不一样就next.
代码
C语言版本:
63 / 63 test cases passed.
Status: Accepted
Runtime: 12 ms
|
|
|
|