diff --git "a/problems/0104.344円272円214円345円217円211円346円240円221円347円232円204円346円234円200円345円244円247円346円267円261円345円272円246円.md" "b/problems/0104.344円272円214円345円217円211円346円240円221円347円232円204円346円234円200円345円244円247円346円267円261円345円272円246円.md" index b74529d638..a7c206afcf 100644 --- "a/problems/0104.344円272円214円345円217円211円346円240円221円347円232円204円346円234円200円345円244円247円346円267円261円345円272円246円.md" +++ "b/problems/0104.344円272円214円345円217円211円346円240円221円347円232円204円346円234円200円345円244円247円346円267円261円345円272円246円.md" @@ -313,6 +313,31 @@ class solution { } ``` +```java +class Solution { + /** + * 递归法(求深度法) + */ + //定义最大深度 + int maxnum = 0; + + public int maxDepth(TreeNode root) { + ans(root,0); + return maxnum; + } + + //递归求解最大深度 + void ans(TreeNode tr,int tmp){ + if(tr==null) return; + tmp++; + maxnum = maxnum

AltStyle によって変換されたページ (->オリジナル) /