JAVA_Maximum Depth of N-ary Tree_LeetCode 559 풀이 class Solution { public int maxDepth(Node root) { if(root==null) return 0; int max=0; for(Node child:root.children) max=Math.max(max,maxDepth(child)); return max+1; } } * 출처 Maximum Depth of N-ary Tree - LeetCode Maximum Depth of N-ary Tree - Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Nary-Tree input serialization is represented in t...
#JAVA
#JAVA_LeetCode559
#JAVA_MaximumDepthofN_aryTree
#JAVA_MaximumDepthofN_aryTree_LeetCode559
#MaximumDepthofN_aryTree_LeetCode559
원문링크 : JAVA_Maximum Depth of N-ary Tree_LeetCode 559