第二个使用栈思想中,循环中不需要新创建ListNode节点,直接将stack.pop()出的结点赋值给phead即可。 while (k-->0){ pHead = stack.pop(); }
点赞

相关推荐

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