Skip to content

Commit 67af754

Browse files
committed
2020.02.26
1 parent e638a57 commit 67af754

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

LeetCode203.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*************************************************************************
2+
> File Name: LeetCode203.c
3+
> Author: ws
4+
5+
> Created Time: 2020年02月26日 星期三 11时20分22秒
6+
************************************************************************/
7+
8+
struct ListNode *removeElement(struct ListNode *head, int val) {
9+
struct ListNode ret, *p = &ret, *q;
10+
ret.next = head;
11+
while (p && p->next) {
12+
if (p->next->val == val) {
13+
q = p->next;
14+
p->next = q->next;
15+
free(q);
16+
} else {
17+
p = p->next;
18+
}
19+
}
20+
return ret.next;
21+
}
22+

0 commit comments

Comments
 (0)