Back to course home
0% completed
Vote For New Content
Why is the output 8 rather than 6?
singhursefamily
Jun 10, 2025
The input is [1,2,3,4,5,null,7,8,null,null,null,9,10].
I calculate the levels as:
[1]
[2, 3]
[4, 5, null, 7]
[8, null, null, null, 9, 10].
Wouldn't the widest level be the last one, which has a width of 6?
The problem solution says 8, however.
0
0
Comments
Comments
Lucy G3 months ago
No it's
[1]
[2,3]
[4,5] [null, 7]
[8, null] [null, null] [null,null] [9,10] they don't explicitly say the last [null,null] because their parent is null
On this page