deno.land / x / masx200_leetcode_test@10.6.5 / n-repeated-element-in-size-2n-array / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
export default function repeatedNTimes(nums: number[]): number { const n = nums.length; while (true) { const x = Math.floor(Math.random() * n), y = Math.floor(Math.random() * n); if (x !== y && nums[x] === nums[y]) { return nums[x]; } }}
masx200_leetcode_test

Version Info

Tagged at
a year ago