题解 | #从单向链表中删除指定值的节点#
从单向链表中删除指定值的节点
https://www.nowcoder.com/practice/f96cd47e812842269058d483a11ced4f
tmp=list(map(int,input().split())) n,head,deleting=tmp[0],tmp[1],tmp[-1] cur,pre,l=[],[],[head] for i in range(2,len(tmp)-1,2): cur.append(tmp[i]) for i in range(3,len(tmp)-1,2): pre.append(tmp[i]) for i in range(len(pre)): l.insert(l.index(pre[i])+1,cur[i]) l.pop(l.index(deleting)) for val in l: print(val,end=" ")