Remove all elements from a linked list of integers that have value val.
Example
Input: 1->2->6->3->4->5->6, val = 6
Output: 1->2->3->4->5
Code
1 | public class ListNode { |
1 | public ListNode removeElements(ListNode head, int val) { |
写BUG的程序猿
Remove all elements from a linked list of integers that have value val.
Input: 1->2->6->3->4->5->6, val = 6
Output: 1->2->3->4->5
1 | public class ListNode { |
1 | public ListNode removeElements(ListNode head, int val) { |