题解 | #从单向链表中删除指定值的节点#

从单向链表中删除指定值的节点

https://www.nowcoder.com/practice/f96cd47e812842269058d483a11ced4f

import sys

str = list(map(int, input().split()))
li = [str[1]]
x = []
y = []
n = 2
while n < len(str) - 2:
    y.append(str[n])
    x.append(str[n + 1])
    n = n + 2
for i in range(len(x)):
    index = li.index(x[i])
    li.insert(index + 1, y[i])
li.remove(str[-1])
for i in li:
    print(i, end=' ')

全部评论

相关推荐

好羡慕走AI技术方向的人,实习薪资这么高😱&nbsp;人比人气死人😭
勇敢的嘟教授在考古:芯片公司挣得多多的,钱给的还不如互联网
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务