g***j 发帖数: 1275 | 1 我这个全部通过了,多半是index的问题
class Solution {
public:
TreeNode *buildTree(vector &inorder, vector &postorder) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(inorder.size() != postorder.size() ||
inorder.size() == 0 || postorder.size() == 0)
return NULL;
return buildTreeHelper(inorder, 0, inorder.size() - 1,
postorder, 0, postorder.size() - 1);
}
Tree... 阅读全帖 |
|