public static void deleteNode(ListNode node) { ListNode nn = node.next; while (nn.next != null) { node.val = nn.val; node = nn; nn = nn.next; } node.val = nn.val; node.next = null; }