记录详情

Compile Error

foo.cc:3:19: error: 'TreeNode' has not been declared
    3 |     void preorder(TreeNode *root, vector<int> &res) {
      |                   ^~~~~~~~
foo.cc:3:35: error: 'vector' has not been declared
    3 |     void preorder(TreeNode *root, vector<int> &res) {
      |                                   ^~~~~~
foo.cc:3:41: error: expected ',' or '...' before '<' token
    3 |     void preorder(TreeNode *root, vector<int> &res) {
      |                                         ^
foo.cc:12:5: error: 'vector' does not name a type
   12 |     vector<int> preorderTraversal(TreeNode *root) {
      |     ^~~~~~
foo.cc: In member function 'void Solution::preorder(int*, int)':
foo.cc:7:9: error: 'res' was not declared in this scope
    7 |         res.push_back(root->val);
      |         ^~~
foo.cc:7:29: error: request for member 'val' in '* root', which is of non-class type 'int'
    7 |         res.push_back(root->val);
      |                             ^~~
foo.cc:8:24: error: request for member 'left' in '* root', which is of non-class type 'int'
    8 |         preorder(root->left, res);
      |                        ^~~~
foo.cc:9:24: error: request for member 'right' in '* root', which is of non-class type 'int'
    9 |         preorder(root->right, res);
      |                        ^~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
自测
题目
DS7-2 先序遍历二叉排序树
语言
C++
递交时间
2021-12-29 20:49:51
评测时间
2021-12-29 20:49:51
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes