deno.land / x / masx200_leetcode_test@10.6.5 / preimage-size-of-factorial-zeroes-function / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export default function preimageSizeFZF(k: number): number { let left = 0, right = k; while (left <= right) { const mid = Math.floor((right + left) / 2);
const basic = calc(mid); if (basic == k) return 5;
if (basic < k) left = mid + 1; if (basic > k) right = mid - 1; } return 0;}
function calc(b: number) { return Array<number>(1 + Math.ceil(Math.log(10 ** 9) / Math.log(5))).fill(0) .reduce((a, _, i) => Math.floor(a + b / Math.pow(5, i)), 0);}
masx200_leetcode_test
leetcode题解和一些测试工具
DocumentationDocumentation
GitHub Repositorymasx200/leetcode-test
GitHub Stars
4

Version Info

Tagged at
4 months ago