/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ class Solution { public: vector<vector<int>> ans; inline void visit(int num, int index) { ans[index].push_back(num); } void preorder(TreeNode* root) { if (NULL == root) { return; } visit(root-&g...