struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
void inorderTraversal(TreeNode *n, vector<int>& result)
{
if (n == NULL) return;
inorderTraversal(n->left, result);
result.push_back(n->val);
inorderTraversal(n->right, result);
}
vector<int> inorderTraversal(TreeNode *root)
{
vector<int> result;
inorderTraversal(root, result);
return result;
}