I'm really new to coding and was stuck at one of the Leetcode problems on Binary Tree Transversing.
Can anyone please explain what the following line of code means:
def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
From what I understood, the core was trying to define a function pre-order traversal and a class TreeNode was defined earlier. However I was not able to get what root: Optional[TreeNode] and ->List[int] meant.
Thanks in advance