想不懂为什么是hard。。。
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int>ve;
void posto(TreeNode* root){
if(root == NULL) return ;
posto(root -> left);
posto(root -> right);
ve.push_back(root -> val);
}
vector<int> postorderTraversal(TreeNode* root) {
posto(root);
return ve;
}
};