94. 二叉樹的中序遍歷

最開始的代碼,用了遞歸,雖然通過了,但是很彆扭。 vector<int> ans; class Solution { public: vector<int> inorderTraversal(TreeNode* root) { ans.clear(); inorder(root); return ans; } void ino
相關文章
相關標籤/搜索