討論串[閒聊] 每日leetcode
共 1548 篇文章
內容預覽:
今天遞迴解起來還蠻順的. 感覺有點手感了. class Solution(object):. def addOneRow(self, root, val, depth):. """. :type root: TreeNode. :type val: int. :type depth: int. :r
(還有486個字)
內容預覽:
https://leetcode.com/problems/add-one-row-to-tree. 623. Add One Row to Tree. 給你一個二元樹,請在深度為depth的位置插入一列值為val的節點。. 思路:. 1.用 bfs 算深度找到 depth - 1 的位置,直接插入
(還有824個字)
內容預覽:
129.. 求路徑上的數字字串合. C# code. public class Solution {. public int SumNumbers(TreeNode root, int num = 0). {. if (root == null) return 0;. num = num * 10
(還有122個字)
內容預覽:
今天有想到 趕快練習一下. 無腦implace改值再加起來. 感覺不太優就是了==. # Definition for a binary tree node.. # class TreeNode(object):. # def __init__(self, val=0, left=None, rig
(還有499個字)
內容預覽:
Python Code:. # Definition for a binary tree node.. # class TreeNode:. # def __init__(self, val=0, left=None, right=None):. # self.val = val. # self.l
(還有459個字)