Ezvor

3831. Median of a Binary Search Tree Level

MediumTree Preparing judge… LeetCode
TreeDepth-First SearchBreadth-First SearchBinary Search TreeBinary Tree

Hints

Hint 1
Use DFS or BFS to gather the node values at level.
Hint 2
Sort the values at that level; if the list is empty, return -1, otherwise return the upper median.