← back to apps
> typing speed test
Type real code snippets as fast as you can. Measure your WPM and accuracy.
TypeScriptBinary Search
—
WPM
—
Accuracy
0:00
Time
0%
binary-search.ts
function binarySearch(arr: number[], target: number): number {↵ let left = 0;↵ let right = arr.length - 1;↵ while (left <= right) {↵ const mid = Math.floor((left + right) / 2);↵ if (arr[mid] === target) return mid;↵ if (arr[mid] < target) left = mid + 1;↵ else right = mid - 1;↵ }↵ return -1;↵ }
start typing to begin...