vargburz
4 years ago
3 changed files with 15 additions and 47008 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@ |
|||||||
|
/** |
||||||
|
* 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; |
Loading…
Reference in new issue