203-Remove Linked List Elements

题意

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

思路

  • 链表删除

分析:

  • Time: O(n)
  • Space: O(1)

© 2020. All rights reserved.