摘要: 二分查找 class Solution { public int shipWithinDays(int[] weights, int days) { /** * 最小运输量为所有货物中最重的那个,否则大于它的货物永远不能运载 */ int minLoad = Arrays.stream(weight 阅读全文
posted @ 2021-10-25 22:50 振袖秋枫问红叶 阅读(40) 评论(0) 推荐(0)
摘要: 二分查找 class Solution { public int minEatingSpeed(int[] piles, int h) { /** * Arrays.stream(arr).max().getAsInt()方法获取数组最大值 */ int minSpeed = 1; int maxS 阅读全文
posted @ 2021-10-25 21:52 振袖秋枫问红叶 阅读(63) 评论(0) 推荐(0)
摘要: upper 查找大于target的第一个元素 public class Algorithm { public static void main(String[] args) { Integer[] arr = {1, 1, 3, 3, 5, 5}; for (int i = 0; i <= 6; i 阅读全文
posted @ 2021-10-25 21:00 振袖秋枫问红叶 阅读(70) 评论(0) 推荐(0)