Given a sorted array and a target key, find the element in the array that has the minimum absolute difference with the given key.
{ "arr": [ 1, 3, 8, 10, 15 ], "key": 12 }
10
{ "arr": [ 4, 7, 10 ], "key": 4 }
4
{ "arr": [ 4, 7, 10 ], "key": 6 }
7
Sign in to Run Code and Submit