devirt-corpus / seeds /s0010_bsearch.js
vasie's picture
Expand corpus to ~9.5k: 500 seeds x 19 obfuscation profiles + real samples
c930535
Raw
History Blame Contribute Delete
192 Bytes
function binarySearch(a,t){let lo=0,hi=a.length-1;while(lo<=hi){const m=(lo+hi)>>1;if(a[m]===t)return m;if(a[m]<t)lo=m+1;else hi=m-1;}return -1;}console.log(binarySearch([2,8,9,9,10,13],13));