Commit 685e0412 authored by yaozc's avatar yaozc
Browse files

problem 94 solved

parent 1a24a66d
......@@ -136,3 +136,23 @@ bool isValidSudoku(vector<vector<char>>& board) {
}
return true;
}
//94. Binary Tree Inorder Traversal
//inorder traversd binary tree, solved by watched the answer
class Solution {
public:
vector<int> inorderTraversal(TreeNode* root) {
if(root){
if (root->left){
inorderTraversal(root->left);
}
result.push_back(root->val);
if(root->right){
inorderTraversal(root->right);
}
}
return result;
}
private:
vector<int> result;
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment