移除链表元素 删除链表中等于给定值val的所有节点。 设置一个虚拟头节点,这样原链表的所有节点就都可以按照统一的方式进行移除了。 public ListNode removeElements(ListNode head, int val) { if(head == null) return head; ListNode dummy = new ListNode(-1,head); ListNode cur = head; ListNode pre = dummy; while(cur != null) { if(cur.val == val) { pre.next = cur.next; }...