1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-21 21:16:45 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给定一棵二叉树,你需要计算它的直径长度。一棵二叉树的直径长度是任意两个结点路径长度中的最大值。这条路径可能穿过也可能不穿过根结点。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 :</strong><br>\n给定二叉树</p>\n\n<pre> 1\n / \\\n 2 3\n / \\ \n 4 5 \n</pre>\n\n<p>返回&nbsp;<strong>3</strong>, 它的长度是路径 [4,2,1,3] 或者&nbsp;[5,2,1,3]。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>注意:</strong>两结点之间的路径长度是以它们之间边的数目表示。</p>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 966,
"likes": 1001,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -55,13 +55,13 @@
{
"lang": "Python",
"langSlug": "python",
"code": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, val=0, left=None, right=None):\n# self.val = val\n# self.left = left\n# self.right = right\nclass Solution(object):\n def diameterOfBinaryTree(self, root):\n \"\"\"\n :type root: TreeNode\n :rtype: int\n \"\"\"",
"code": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, val=0, left=None, right=None):\n# self.val = val\n# self.left = left\n# self.right = right\nclass Solution(object):\n def diameterOfBinaryTree(self, root):\n \"\"\"\n :type root: TreeNode\n :rtype: int\n \"\"\"\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "Python3",
"langSlug": "python3",
"code": "# Definition for a binary tree node.\n# class TreeNode:\n# def __init__(self, val=0, left=None, right=None):\n# self.val = val\n# self.left = left\n# self.right = right\nclass Solution:\n def diameterOfBinaryTree(self, root: TreeNode) -> int:",
"code": "# Definition for a binary tree node.\n# class TreeNode:\n# def __init__(self, val=0, left=None, right=None):\n# self.val = val\n# self.left = left\n# self.right = right\nclass Solution:\n def diameterOfBinaryTree(self, root: Optional[TreeNode]) -> int:",
"__typename": "CodeSnippetNode"
},
{
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"197.7K\", \"totalSubmission\": \"349.7K\", \"totalAcceptedRaw\": 197703, \"totalSubmissionRaw\": 349728, \"acRate\": \"56.5%\"}",
"stats": "{\"totalAccepted\": \"209.3K\", \"totalSubmission\": \"368.8K\", \"totalAcceptedRaw\": 209289, \"totalSubmissionRaw\": 368819, \"acRate\": \"56.7%\"}",
"hints": [],
"solution": null,
"status": null,