```
class Solution {
public:
vector<int> res = {};
vector<int> inorderTraversal(TreeNode* root) {
if(!root) return res;
traver(root);
return res;
}
void traver(TreeNode* root){
if(root->left) traver(root->left);
res.push_back(root->val);
if(root->right) traver(root->right);
}
};
```