1. How I sloved

    I had to make a linked list without duplicate values. So if the value of ‘cur’ was equal to the value of ‘cur.next’, ‘cur’ was connected to ‘cur.next.next’. Otherwise, ‘cur’ just moved to ‘next’. Then head was returned.

2. Code

class Solution:
    def deleteDuplicates(self, head: ListNode) -> ListNode:
        if head == None:
            return
        cur = head
        while cur:
            if cur.val == cur.next.val:
                cur.next = cur.next.next
            else:
                cur = cur.next
        return head

3. Result

        Runtime : 36 ms(93.93%), Memory usage : 14 MB(100.00%)
        (Runtime can be different by a system even if it is a same code.)

Check out the my GitHub repo for more info on the code. If you have questions, you can leave a reply on this post.