# Easy-题目51：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

class Solution {
public:
ListNode* removeElements(ListNode* head, int val) {
if(!p || (!p->next && p->val==val))//p is null or (length of linklist=1 and this unique node is going to be deleted)
return NULL;
else {
while(q) {
if(q->val==val) {// the first node is going to be deleted
p->next=p->next->next;
q=q->next;
continue;
}
else {
p=p->next;
q=q->next;
}
}
else
}
}
};

32ms,beats 54.36%,众数36ms,45.72%.

#### Easy-题目67：8. String to Integer (atoi)

2016-05-30 22:44:59

#### Easy-题目64：168. Excel Sheet Column Title

2016-05-30 22:42:10

#### Easy-题目60：125. Valid Palindrome

2016-05-30 22:36:31

#### Easy-题目59：204. Count Primes

2016-05-30 22:35:43

#### Easy-题目56：303. Range Sum Query – Immutable

2016-05-30 20:54:15

#### leetcode 203: Remove Linked List Elements

2015-04-25 06:47:30

2016-04-13 08:31:57

#### 203. Remove Linked List Elements（python）

2016-09-18 21:39:48

#### 203. Remove Linked List Elements [easy] (Python)

2016-06-18 16:30:01

#### leetcode 203 Remove Linked List Elements

2015-04-29 15:01:55