题解 | #从单向链表中删除指定值的节点#
从单向链表中删除指定值的节点
https://www.nowcoder.com/practice/f96cd47e812842269058d483a11ced4f
from os import remove while 1: try: l=list(map(int,input().split())) n=l[0] l_list=[l[1]] note=[] for i in range(1,n): a=l[2*i:2*(i+1)] note.append(a) for j in l_list: if j==a[1]: l_list[(l_list.index(j)+1):(l_list.index(j)+1)]=[a[0]] del_note=l[-1] l_list.remove(del_note) for i in l_list: print(i,end=' ') except: break