Re: [LeetCode] 刷到面試 Grind169 C++

看板Marginalman作者 (彗星雷達)時間2年前 (2023/03/15 16:23), 編輯推噓0(003)
留言3則, 2人參與, 2年前最新討論串6/14 (看更多)
226. Invert Binary Tree easy題 二差樹歷遍而已 難得我會 但我runtime跟memory超爛 是要改迭代比較好嗎 class Solution { public: TreeNode* invertTree(TreeNode* root) { if(root == NULL) return root; invertTree(root->left); invertTree(root->right); swap(root->left, root->right); return root; } }; -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.136.220 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1678868638.A.19C.html

03/15 16:29, 2年前 , 1F
好強喔我才剛在學資料型態==
03/15 16:29, 1F

03/15 16:30, 2年前 , 2F
別學了 直接開刷 不會再回頭看
03/15 16:30, 2F

03/15 16:31, 2年前 , 3F
好 跟著大師走
03/15 16:31, 3F
文章代碼(AID): #1a4O2U6S (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1a4O2U6S (Marginalman)