> For the complete documentation index, see [llms.txt](https://emmaguo100.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emmaguo100.gitbook.io/leetcode/01-09-2022-203.md).

# 01/09/2022 203

![](/files/gM3RbVftSSAjdaIZZT43)

create a dummy node and set it as the new head

Initiate two pointers to track the current node and its predecessor: `curr` and `prev`.

Compare the value of the current node with the value to delete.

In the values are equal, delete the current node: `prev.next = curr.next`.

Otherwise, set predecessor to be equal to the current node.Move to the next node: `curr = curr.next`.`finally return dummy.next`.

Time O(n) Space O(1)
