mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一棵以 <code>root</code> 为根的二叉树,二叉树中的交错路径定义如下:</p>\n\n<ul>\n\t<li>选择二叉树中 <strong>任意</strong> 节点和一个方向(左或者右)。</li>\n\t<li>如果前进方向为右,那么移动到当前节点的的右子节点,否则移动到它的左子节点。</li>\n\t<li>改变前进方向:左变右或者右变左。</li>\n\t<li>重复第二步和第三步,直到你在树中无法继续移动。</li>\n</ul>\n\n<p>交错路径的长度定义为:<strong>访问过的节点数目 - 1</strong>(单个节点的路径长度为 0 )。</p>\n\n<p>请你返回给定树中最长 <strong>交错路径</strong> 的长度。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/03/07/sample_1_1702.png\" style=\"height: 283px; width: 151px;\"></strong></p>\n\n<pre><strong>输入:</strong>root = [1,null,1,1,1,null,null,1,1,null,1,null,null,null,1,null,1]\n<strong>输出:</strong>3\n<strong>解释:</strong>蓝色节点为树中最长交错路径(右 -> 左 -> 右)。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/03/07/sample_2_1702.png\" style=\"height: 253px; width: 120px;\"></strong></p>\n\n<pre><strong>输入:</strong>root = [1,1,1,null,1,null,null,1,1,null,1]\n<strong>输出:</strong>4\n<strong>解释:</strong>蓝色节点为树中最长交错路径(左 -> 右 -> 左 -> 右)。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>root = [1]\n<strong>输出:</strong>0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>每棵树最多有 <code>50000</code> 个节点。</li>\n\t<li>每个节点的值在 <code>[1, 100]</code> 之间。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 70,
|
||||
"likes": 73,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.7K\", \"totalSubmission\": \"18.6K\", \"totalAcceptedRaw\": 9715, \"totalSubmissionRaw\": 18614, \"acRate\": \"52.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10K\", \"totalSubmission\": \"19K\", \"totalAcceptedRaw\": 9965, \"totalSubmissionRaw\": 19015, \"acRate\": \"52.4%\"}",
|
||||
"hints": [
|
||||
"Create this function maxZigZag(node, direction) maximum zigzag given a node and direction (right or left)."
|
||||
],
|
||||
|
Reference in New Issue
Block a user