作者SecondRun (雨とカプチーノ)
看板Marginalman
標題Re: [閒聊] 每日LeetCode
時間Thu Feb 16 09:18:25 2023
104. Maximum Depth of Binary Tree
找出一棵二元樹的max depth
C# code
public class Solution {
public int MaxDepth(TreeNode node) {
if (node == null) return 0;
return 1+Math.Max(MaxDepth(node.left),MaxDepth(node.right));
}
}
捏
--
(づ′・ω・)づ
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.241.148.203 (日本)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1676510308.A.458.html
推 a9486l: 大師 02/16 09:18
→ Rushia: 撞車 02/16 09:21
→ SecondRun: 笑了 02/16 09:21
→ MurasakiSion: 大師 02/16 09:24
→ idiont: 大師 02/16 11:23