We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
出处 LeetCode 算法第203题 删除链表中等于给定值 val 的所有节点。 示例: 输入: 1->2->6->3->4->5->6, val = 6 输出: 1->2->3->4->5
出处 LeetCode 算法第203题
删除链表中等于给定值 val 的所有节点。
示例:
输入: 1->2->6->3->4->5->6, val = 6 输出: 1->2->3->4->5
顺序遍历
/** * @param {ListNode} head * @param {number} val * @return {ListNode} */ var removeElements = function(head, val) { var first = new ListNode(); first.next = head; var flag = first; while(head) { if (head.val == val) { first.next = head.next; head = head.next; } else { head = head.next; first = first.next; } } return flag.next; };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
习题
思路
顺序遍历
解答
The text was updated successfully, but these errors were encountered: