MCPcopy Create free account
hub / github.com/aizk/algorithm-practice / TreeNode

Struct TreeNode

tree/0662-maximum-width-of-binary-tree/main.go:69–73  ·  view source on GitHub ↗

给定一个二叉树,编写一个函数来获取这个树的最大宽度。树的宽度是所有层中的最大宽度。这个二叉树与满二叉树(full binary tree)结构相同,但一些节点为空。 每一层的宽度被定义为两个端点(该层最左和最右的非空节点,两端点间的null节点也计入长度)之间的长度。 示例 1: 输入: 1 \ 3 2 \ \ 5 3 9 输出: 4 解释: 最大值出现在树的第 3 层,宽度为 4 (5,3,null,9)。 示例 2: 输入: 1 3 \ 5 3 输出: 2 解释: 最大值出现在树的第 3 层,宽度为 2 (5,3)。 示例 3:

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected