Given a binary tree, return the inorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
2
/
3
Output: [1,3,2]
1 class Solution { 2 public: 3 void build(TreeNode*root, vector<int>&ans) { 4 if (root == NULL)return; 5 build(root->left, ans); 6 ans.push_back(root->val); 7 build(root->right, ans); 8 } 9 vector<int> inorderTraversal(TreeNode* root) { 10 vector<int>ans; 11 build(root, ans); 12 return ans; 13 } 14 };