--- title: "爱吃香蕉的珂珂" created: 2025-11-28 tags: - 算法 --- # 爱吃香蕉的珂珂 ## 题目 [爱吃香蕉的珂珂](https://leetcode-cn.com/problems/koko-eating-bananas/) ![[image-68546559.png]] ## 思路分析 ![[image-ae57342a.png]] ## 代码实现 ```java class Solution { public: bool check(int mid,vector& piles,int h){ int cnt=0; for(auto pile:piles){ cnt+=(pile+mid-1)/mid; } if(cnt<=h) return true; return false; } int minEatingSpeed(vector& piles, int h) { int l=1,r=1e9; while(l>1; if(check(mid,piles,h)) r=mid; else l=mid+1; } return r; } }; ``` ## 同类题型 ## 视频讲解 --- ⬅️ [[楼梯|楼梯]] 🏠 [[00-刷题理模型]] ➡️ [[2-Learning/02-算法/03-刷题理模型/二分相关模型/管道|管道]]