You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
317 B
8 lines
317 B
/** |
|
* Finds the closest item to a given number in an array using binary search |
|
* @argument arr: ascending sorted array |
|
* @argument num: number to find |
|
* @returns index of the closest item to `num` |
|
* @returns -1 if given array is empty |
|
*/ |
|
export declare function findClosest(arr: number[], num: number): number;
|
|
|