2023-09-07力扣每日一题

链接:

[2594. 修车的最少时间](https://leetcode.cn/problems/minimum-time-to-repair-cars/)\](https://leetcode.cn/problems/form-smallest-number-from-two-digit-arrays/) **题意:** 一个能力R的人R\*N\*N分钟修N辆车,求最快多久修完(多人多车) **解:** 二分很好想,主要是怎么检查(数学废物润去看题解了) **实际代码:** ```c++ long long repairCars(vector& ranks, int cars) { typedef long long int ll; sort(ranks.begin(),ranks.end()); ll l=1,r=1ll*ranks[ranks.size()-1]*pow(cars,2); while(l>1; ll cnt=0; for(auto rank:ranks) cnt+=sqrt(m/rank); if(cnt>=cars) r=m; else l=m+1; } return l; } ``` 限制: * `1 <= ranks.length <= 105` * `1 <= ranks[i] <= 100` * `1 <= cars <= 106`

相关推荐
mask哥42 分钟前
力扣算法java实现汇总整理(下)
java·算法·leetcode
样例过了就是过了1 小时前
LeetCode热题100 编辑距离
数据结构·c++·算法·leetcode·动态规划
khalil10202 小时前
代码随想录算法训练营Day-46 动态规划13 | 647. 回文子串、516.最长回文子序列、动态规划总结
数据结构·c++·算法·leetcode·动态规划·回文子串·回文子序列
he___H2 小时前
算法快与慢--哈希+双指针
算法·leetcode·哈希算法
凯瑟琳.奥古斯特3 小时前
力扣2760 C++滑动窗口解法
数据结构·c++·算法·leetcode·职场和发展
_深海凉_3 小时前
LeetCode热题100-不同路径
算法·leetcode·职场和发展
m0_629494735 小时前
LeetCode 热题 100-----23.反转链表
数据结构·算法·leetcode·链表
Chase_______6 小时前
LeetCode 1493 & 3634 题解:滑动窗口双指针,从“删一个元素的全1子数组“到“最少移除使数组平衡“
算法·leetcode
悲伤小伞6 小时前
LeetCode 热题 100_4-283. 移动零
算法·leetcode·职场和发展
OYangxf6 小时前
力扣hot100【滑动窗口】
算法·leetcode·职场和发展