Leetcode 94. Binary Tree Inorder Traversal
문제 : 94. Binary Tree Inorder Traversal
등급 : Easy
class Solution {
vector<int> trav(TreeNode *root) {
auto l = inorderTraversal(root->left);
l.push_back(root->val);
for (auto & re: inorderTraversal(root->right)) {
l.push_back(re);
}
return l;
}
public:
vector<int> inorderTraversal(TreeNode* root) {
if (!root)
return {};
return trav(root);
}
};