Preorder
\nclass Solution {\npublic:\n    vector<int> a;\n    void preorder(TreeNode* root)\n    {\n        if(root)\n        {\n            a.push_back(root->val);\n   
```\nclass Solution {\npublic:\n    vector<int> a;\n    void preorder(TreeNode* root)\n    {\n        if(root)\n        {\n            a.push_back(root->val);\n            preorder(root->left);\n            preorder(root->right);\n        }\n    }\n    vector<int> preorderTraversal(TreeNode* root) {\n        preorder(root);\n        return a;\n    }\n};\n```
[]