当前位置:网站首页>不会就坚持68天吧 狒狒吃香蕉
不会就坚持68天吧 狒狒吃香蕉
2022-07-29 04:13:00 【一只小小明】

class Solution {
public int minEatingSpeed(int[] piles, int h) {
int low = 1;
int high = 0;
for (int pile : piles) {
high = Math.max(high, pile);
}
int k = high;
while (low < high) {
int speed = (high - low) / 2 + low;
long time = getTime(piles, speed);
if (time <= h) {
k = speed;
high = speed;
} else {
low = speed + 1;
}
}
return k;
}
public long getTime(int[] piles, int speed) {
long time = 0;
for (int pile : piles) {
int curTime = (pile + speed - 1) / speed;
time += curTime;
}
return time;
}
}
作者:LeetCode-Solution
链接:https://leetcode.cn/problems/nZZqjQ/solution/fei-fei-chi-xiang-jiao-by-leetcode-solut-0jge/
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。边栏推荐
- Methods of using multiple deformations on an element
- [原理] 横向渗透的几种方式
- How to write the filter conditions of data integration and what syntax to use? SQL syntax processing bizdate can not be
- 数据集成这个地方的过滤条件该咋写,用的啥语法?sql语法处理bizdate可以不
- How to set the SQL execution timeout for flick SQL
- Lua语言(stm32+2G/4G模块)和C语言(stm32+esp8266)从字符串中提取相关数据的方法-整理
- 路由 知识
- Pointer variables -printf%d and%p meaning
- MySQL gets the maximum value record by field grouping
- Is the array name a pointer
猜你喜欢

通过js来实现一元二次方程的效果,输入a,b,c系数后可计算出x1和x2的值

信号处理中的反傅里叶变换(IFFT)原理

Fu Yingna: Yuan universe is the new generation of Internet!

Lua语言(stm32+2G/4G模块)和C语言(stm32+esp8266)从字符串中提取相关数据的方法-整理

Nacos registry

Mmdetection preliminary use

Lua language (stm32+2g/4g module) and C language (stm32+esp8266) methods of extracting relevant data from strings - collation

编译与链接
![[principle] several ways of horizontal penetration](/img/fc/2ef7dd6ebc5c0bd8f7d302d8b596d6.png)
[principle] several ways of horizontal penetration

全屋WiFi方案:Mesh路由器组网和AC+AP
随机推荐
数据集成这个地方的过滤条件该咋写,用的啥语法?sql语法处理bizdate可以不
mmdetection初步使用
About the writing of ALV format control part
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0x90 in position 614: ordinal not in range(128)
How to query the submission number of a version
Object detection: object_ Detection API +ssd target detection model
SVG--loading动画
Const read only variable constant
有没有大佬帮我看下flink sql连接kafka认证kerberos的参数配置是否有误
力扣面试题17.04 消失的数字||260.只出现一次的数字(内含位运算知识点)
小程序:区域滚动、下拉刷新、上拉加载更多
A little understanding of pointer, secondary pointer, wild pointer, pointer as function return value
Ma Zhixing entered the mass production of front loading, starting with the self-developed domain controller?
店铺排名问题,如何解决?
Design of environment detection system based on STM32 and Alibaba cloud
Why do I delete the original record (OP d) and then add a new one in Kafka when I update MySQL data
C language to achieve three chess game (detailed explanation)
SQL server当存储过程接收的参数是int类型时,如何做判断?
MySQL Part 3
The structure pointer must be initialized, and the pointer must also be initialized