feat(content): more test cases
This commit is contained in:
@@ -10,6 +10,26 @@ patterns:
|
||||
- dfs
|
||||
- tree-traversal
|
||||
|
||||
function_signature: "def diameter_of_binary_tree(root: TreeNode) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { root: [1, 2, 3, 4, 5] }
|
||||
expected: 3
|
||||
- input: { root: [1, 2] }
|
||||
expected: 1
|
||||
hidden:
|
||||
- input: { root: [1] }
|
||||
expected: 0
|
||||
- input: { root: [1, 2, 3] }
|
||||
expected: 2
|
||||
- input: { root: [1, 2, null, 3, null, 4] }
|
||||
expected: 3
|
||||
- input: { root: [1, 2, 3, 4, 5, 6, 7] }
|
||||
expected: 4
|
||||
- input: { root: [4, -7, -3, null, null, -9, -3, 9, -7, -4, null, 6, null, -6, -6, null, null, 0, 6, 5, null, 9, null, null, -1, -4, null, null, null, -2] }
|
||||
expected: 8
|
||||
|
||||
description: |
|
||||
Given the `root` of a binary tree, return *the length of the **diameter** of the tree*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user