Grokking Data Structures & Algorithms for Coding Interviews
Vote

0% completed

​

Closest Binary Search Tree Value (medium)

.....

.....

.....

Like the course? Get enrolled and start learning!
A

Anonymous

· 3 years ago

[50,30,70,10,40,60,90]

closest: 55

Output 60

Expected 50

In mathematics, when a number is exactly in the middle of two others, as 55 is between 50 and 60, it's customary to round up. Therefore, 55 is considered closer to 60. The test case and provided solution is wrong.

Show 2 replies

Reading Progress

0%


Vote for new content