Python3 | easiest solution
\nclass Solution:\n    def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]:\n        res = []\n        \n        if root:\n            res+= [roo
```\nclass Solution:\n    def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]:\n        res = []\n        \n        if root:\n            res+= [root.val]\n            res+= self.preorderTraversal(root.left)\n            res+= self.preorderTraversal(root.right)\n        return res\n```
['Python', 'Python3']