deno.land / x / masx200_leetcode_test@10.6.5 / find-smallest-letter-greater-than-target / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
export default function nextGreatestLetter( letters: string[], target: string,): string { const length = letters.length; if (target >= letters[length - 1]) { return letters[0]; } let low = 0, high = length - 1; while (low < high) { const mid = Math.floor((high + low) / 2); if (letters[mid] > target) { high = mid; } else { low = mid + 1; } } return letters[low];}
masx200_leetcode_test

Version Info

Tagged at
a year ago