精華區beta Marginalman 關於我們 聯絡資訊
129. 求路徑上的數字字串合 C# code public class Solution { public int SumNumbers(TreeNode root, int num = 0) { if (root == null) return 0; num = num * 10 + root.val; if (root.left == null && root.right == null) return num; return SumNumbers(root.left, num) + SumNumbers(root.right, num); } } -- (づ′・ω・)づ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.220.51.52 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1713173453.A.0CA.html
DJYOSHITAKA: 大濕 04/15 17:31
sustainer123: 大師 04/15 17:31
JIWP: 大師 04/15 17:40
digua: 大師 04/15 17:44