Given the root of a binary search tree and an integer level, return the median value of all node values located at that level.
If the number of nodes at the specified level is even, return the larger of the two middle values after sorting. If no nodes exist at the given level, return
Note: The
rootof the tree is located atlevel.
Constraints:
The number of nodes in the tree is in the range
Node.val
level
Given the root of a binary search tree and an integer level, return the median value of all node values located at that level.
If the number of nodes at the specified level is even, return the larger of the two middle values after sorting. If no nodes exist at the given level, return
Note: The
rootof the tree is located atlevel.
Constraints:
The number of nodes in the tree is in the range
Node.val
level