题解 | #从单向链表中删除指定值的节点#
从单向链表中删除指定值的节点
http://www.nowcoder.com/questionTerminal/f96cd47e812842269058d483a11ced4f
思路:
👍最后的空格
代码:
while True: try: l = input().split() head = l[1] rm = l[-1] l = l[2:-1] res = [head] for i in range(0, len(l), 2): # i = i*2 # if i>len(l): # break a = l[i] b = l[i+1] res.insert(res.index(b)+1, a) res.remove(rm) print(' '.join(res)+" ") except: break