题解 | #从单向链表中删除指定值的节点#
从单向链表中删除指定值的节点
https://www.nowcoder.com/practice/f96cd47e812842269058d483a11ced4f
while 1: try: raw = [int(s) for s in input().split()] num, head, dd = raw[0], raw[1], raw[-1] one = list() for i in range(2, len(raw) - 2, 2): one.append((raw[i + 1], raw[i])) linkList = [head] for o in one: index = linkList.index(o[0]) linkList.insert(index + 1, o[1]) linkList.remove(dd) print(' '.join([str(i) for i in linkList])) except: break