270. Closest Binary Search Tree Value

Problem

Given a non-empty BST and a target, find the value in the BST that is closest to the target.

Given the root of a Binary Search Tree (BST) and a target value, find the value in the BST that is closest to the target. If two values are equally close, return the smaller value.

Examples
Input: [[8,4,12,2,6,10,14],2.25]
Output: 2
Hints
Related Problems

270. Closest Binary Search Tree Value

Given a non-empty BST and a target, find the value in the BST that is closest to the target.