楼主没答出来,社区高手试试?我觉得能答出来的人不超过 1%

题目:给定一个不确定的 json 对象,求 json 子节点的最大深度,如:

编程语言不限,不可写伪代码

{
   "item":{
          "data": {
            "text": "123",
        },
        "children": [{
            "data": {
                "text": "234"
            },
            "children": []
        }, {
            "data": {
                "text": "345"
            },
            "children": [{
                "data": {
                    "text": "456"
                },
                "children": []
            }, {
                "data": {
                    "text": "plid"
                },
                "children": [{
                    "data": {
                        "text": "567"
                    },
                    "children": [....]
                }, {
                    "data": {
                        "text": "678"
                    },
                    "children": [...]
                }
                ]
        }, {
                // 不确定长度的Children节点
            }
}


↙↙↙阅读原文可查看相关链接,并与作者交流