有一点对数组的用法与Math方法取整用法记录一下吧 class Solution { public int minEatingSpeed(int[] piles, int h) { int left =0; int right = Arrays.stream(piles).max().getAsIn Read More
posted @ 2021-09-04 17:15
K峰
Views(135)
Comments(0)
Diggs(0)
就记录一下,二分法的用法以及前缀和的用法。 这个题的概率问题,依靠前缀和法把w的每个元素的 概率问题依靠向前求和 然后使用二分法,找出random生成元素的所在位置下标即可。 class Solution { int[] w; public Solution(int[] w) { for(int i Read More
posted @ 2021-09-04 16:37
K峰
Views(114)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号