# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python3 (fastai)
#     language: python
#     name: fastai
# ---

# https://leetcode.com/problems/remove-duplicates-from-sorted-list/

# +
# Definition for singly-linked list.
class ListNode:
    def __init__(self, x):
        self.val = x
        self.next = None

# my solution
class Solution:
    def deleteDuplicates(self, head: ListNode) -> ListNode:
        node = head
        while node:
            nxt = node.next
            while nxt and nxt.val == node.val:
                nxt = nxt.next
            node.next = node = nxt
        return head
# -



StarcoderdataJupyterScriptsDedupFiltered