Why do we use Optional[ListNode]?

Viewed 1033

I'm new to python programming. While solving a question on leetcode, I came across the below line of code.

def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]:

It'd be very helpful if someone can explain why do we use Optional[ListNode]?

**What does it do? How is it useful? **

1 Answers
Related