This commit is contained in:
krahets
2023-10-17 20:29:28 +08:00
parent 44ebc7748b
commit de9bf5a57a
5 changed files with 44 additions and 8 deletions

View File

@ -186,7 +186,18 @@ comments: true
=== "C"
```c title="preorder_traversal_i_compact.c"
[class]{}-[func]{preOrder}
/* 前序遍历:例题一 */
void preOrder(TreeNode *root) {
if (root == NULL) {
return;
}
if (root->val == 7) {
// 记录解
vectorPushback(res, root, sizeof(int));
}
preOrder(root->left);
preOrder(root->right);
}
```
=== "Zig"