今際の国の呵呵君
Friday, December 28, 2018
[LeetCode]Remove Linked List Elements
给定头结点和删除的节点,让我们删除指定的节点。做法很简单,一直monitor下一个节点是不是我们要删除的节点即可。注意头结点可能被删除所以head会变化,我们用helper节点来帮我们keep track of新的head节点。O(N)时间,常数空间。代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment