// head = removeValue(head, 2);public static Node removeValue(Node head, int num) {// head来到第一个不需要删的位置while (head != null) {if (head.value != num) {break;}head = head.next;}//head来到第一个不需要删的位置Node pre = head;Node cur = head;while (cur != null) {if (cur.value == num) {pre.next = cur.next;} else {pre = cur;}cur = cur.next;}return head;}
