package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/maximum-depth-of-n-ary-tree/
 */
public class Problem559 {
    private static class Node {
        public int val;
        public List<Node> children;

        public Node() {
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    public int maxDepth(Node root) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem559 prob = new Problem559();
    }
}

@@ -438,24 +438,37 @@
     
-// TODO%0A
+if (root == null) %7B%0A 
         
 retu
@@ -463,16 +463,19 @@
         
+   
 return 0
@@ -484,98 +484,160 @@
     
-%7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem559 prob = new Problem559()
+    %7D%0A        int max = 1;%0A        for (Node child : root.children) %7B%0A            max = Math.max(max, maxDepth(child) + 1);%0A        %7D%0A        return max
 ;%0A  

Solve problem 559