题解 | #从单向链表中删除指定值的节点#
从单向链表中删除指定值的节点
https://www.nowcoder.com/practice/f96cd47e812842269058d483a11ced4f
import sys #实现目标,而结构可以忽略 s_list = [int(i) for i in input().split()] m_list = [] m_list.append(s_list[1]) n = s_list[0] for i in range(2,2*n-1,2): # print(i) a = s_list[i]#使用的数字 b = s_list[i+1]#前面的数字 # print(a,b) m_list.insert(m_list.index(b)+1,a) # print(m_list) for i in range(2*n,len(s_list)): m_list.remove(s_list[i]) print(*m_list)