Re: [閒聊] 每日leetcode已回收

看板Marginalman作者 (南爹摳打)時間1年前 (2024/04/14 16:47), 1年前編輯推噓0(000)
留言0則, 0人參與, 最新討論串117/1548 (看更多)
※ 引述《sustainer123 (caster )》之銘言: : https://leetcode.com/problems/sum-of-left-leaves : 404. Sum of Left Leaves : 求左子葉和 C# code public class Solution { public int SumOfLeftLeaves(TreeNode root, bool isLeft = false) { if (root == null) return 0; if (isLeft && root.left == null && root.right == null) return root.val ; return SumOfLeftLeaves(root.left, true) + SumOfLeftLeaves(root.right, false); } } 窩只寫簡單 中級偶爾 HARD跳過== -- (づ′・ω・)づ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 49.158.160.52 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1713084427.A.1F8.html ※ 編輯: SecondRun (49.158.160.52 臺灣), 04/14/2024 16:52:14
文章代碼(AID): #1c6vWB7u (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1c6vWB7u (Marginalman)