top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Given an array of sorted integers and find the closest value to the given number?

0 votes
490 views

Given an array of sorted integers and find the closest value to the given number. Array may contain duplicate values and negative numbers.

Example : Array : 2,5,6,7,8,8,9
Target number : 5
Output : 5

Target number : 11
Output : 9

Target Number : 4
Output : 5

posted Nov 21, 2017 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

Given an unsorted array which has a number in the majority (a number appears more than 50% in the array), how to find that number?

+1 vote

Are the expressions arr and &arr same for an array of integers?

...