This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Given a sorted array of numbers, find how many elements are less than a given number | |
//Do not include any NaN in the array. | |
function how_many_less(arr, n) { | |
if (!arr.length || arr[0] >= n) return 0; | |
let low = 0, high = arr.length; | |
while (high > low) { | |
let mid = Math.floor((high + low) / 2); | |
if (arr[mid] >= n) high = mid; | |
else if (arr[mid + 1] < n) low = mid; | |
else return mid + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Computer Information: | |
Manufacturer: Unknown | |
Model: Unknown | |
Form Factor: Desktop | |
No Touch Input Detected | |
Processor Information: | |
CPU Vendor: GenuineIntel | |
CPU Brand: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz | |
CPU Family: 0x6 |
OlderNewer