討論串[閒聊] 每日leetcode
共 1548 篇文章

推噓2(2推 0噓 0→)留言2則,0人參與, 1年前最新作者argorok (死肥肥社管)時間1年前 (2024/04/16 09:58), 1年前編輯資訊
0
0
1
內容預覽:
今天遞迴解起來還蠻順的. 感覺有點手感了. class Solution(object):. def addOneRow(self, root, val, depth):. """. :type root: TreeNode. :type val: int. :type depth: int. :r
(還有486個字)

推噓1(1推 0噓 0→)留言1則,0人參與, 1年前最新作者Rushia (早瀬ユウカの体操服 )時間1年前 (2024/04/16 09:16), 編輯資訊
0
0
1
內容預覽:
https://leetcode.com/problems/add-one-row-to-tree. 623. Add One Row to Tree. 給你一個二元樹,請在深度為depth的位置插入一列值為val的節點。. 思路:. 1.用 bfs 算深度找到 depth - 1 的位置,直接插入
(還有824個字)

推噓2(2推 0噓 2→)留言4則,0人參與, 1年前最新作者SecondRun (南爹摳打)時間1年前 (2024/04/15 17:30), 編輯資訊
0
0
0
內容預覽:
129.. 求路徑上的數字字串合. C# code. public class Solution {. public int SumNumbers(TreeNode root, int num = 0). {. if (root == null) return 0;. num = num * 10
(還有122個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者argorok (死肥肥社管)時間1年前 (2024/04/15 14:10), 編輯資訊
0
0
0
內容預覽:
今天有想到 趕快練習一下. 無腦implace改值再加起來. 感覺不太優就是了==. # Definition for a binary tree node.. # class TreeNode(object):. # def __init__(self, val=0, left=None, rig
(還有499個字)

推噓0(0推 0噓 1→)留言1則,0人參與, 1年前最新作者sustainer123 (caster )時間1年前 (2024/04/15 09:34), 編輯資訊
0
0
1
內容預覽:
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個字)