import typing class ListNode: """ListNode is the leetcode "standard library" type used in linked lists""" def __init__(self, val=0, next: typing.Optional["ListNode"] = None): # no qa self.val = val self.next = next