82. Remove Duplicates from Sorted List II - with method Dummy node
Intuition\nUse dummy node.\n\n# Approach\nDummy node.\n\n# Complexity\n- Time complexity: O(n)\n\n\n- Space complexity: O(1)\n\n\n# Code\n\n/**\n * Definition f
# Intuition\nUse dummy node.\n\n# Approach\nDummy node.\n\n# Complexity\n- Time complexity: $$O(n)$$\n\n\n- Space complexity: $$O(1)$$\n\n\n# Code\n```\n/**\n * Definition for singly-linked list.\n * type ListNode struct {\n *     Val int\n *     Next *ListNode\n * }\n */\nfunc deleteDuplicates(head *ListNode) *ListNode {\n\t// \u0421\u043E\u0437\u0434\u0430\u0435\u043C \u0444\u0438\u043A\u0442\u0438\u0432\u043D\u044B\u0439 \u0443\u0437\u0435\u043B, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u0443\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442 \u043D\u0430 \u043D\u0430\u0447\u0430\u043B\u043E \u0441\u043F\u0438\u0441\u043A\u0430\n\tdummy := &ListNode{0, head}\n\n\t// \u0418\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0435\u043C \u0434\u0432\u0430 \u0443\u043A\u0430\u0437\u0430\u0442\u0435\u043B\u044F: prev \u0438 curr\n\tprev := dummy\n\tcurr := head\n\n\t// \u041F\u0440\u043E\u0445\u043E\u0434\u0438\u043C \u043F\u043E \u0441\u043F\u0438\u0441\u043A\u0443\n\tfor curr != nil {\n\t\t// \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C, \u0435\u0441\u0442\u044C \u043B\u0438 \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442\u044B\n\t\tfor curr.Next != nil && curr.Val == curr.Next.Val {\n\t\t\tcurr = curr.Next\n\t\t}\n\n\t\t// \u0415\u0441\u043B\u0438 curr \u043D\u0435 \u0441\u0434\u0432\u0438\u043D\u0443\u043B\u0430\u0441\u044C, \u0437\u043D\u0430\u0447\u0438\u0442, \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442\u043E\u0432 \u043D\u0435\u0442\n\t\tif prev.Next == curr {\n\t\t\tprev = prev.Next\n\t\t} else {\n\t\t\t// \u0415\u0441\u043B\u0438 \u0441\u0434\u0432\u0438\u043D\u0443\u043B\u0430\u0441\u044C, \u0437\u043D\u0430\u0447\u0438\u0442, \u0435\u0441\u0442\u044C \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442\u044B, \u0438 \u043C\u044B \u043F\u0440\u043E\u043F\u0443\u0441\u043A\u0430\u0435\u043C \u0438\u0445\n\t\t\tprev.Next = curr.Next\n\t\t}\n\n\t\tcurr = curr.Next\n\t}\n\n\t// \u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043C \u043D\u043E\u0432\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A\n\treturn dummy.Next\n}\n```
['Go']