Re: [闲聊] 每日leetcode

楼主: Rushia (みけねこ的鼻屎)   2024-06-19 16:36:18
※ 引述《oin1104 (是oin的说)》之铭言:
: 1482. Minimum Number of Days to Make m Bouquets
: You are given an integer array bloomDay, an integer m and an integer k.
: You want to make m bouquets. To make a bouquet, you need to use k adjacent flowe
: rs from the garden.
: The garden consists of n flowers, the ith flower will bloom in the bloomDay[i] a
: nd then can be used in exactly one bouquet.
: Return the minimum number of days you need to wait to be able to make m bouquets
: from the garden. If it is impossible to make m bouquets return -1.
: Example 1:
: Input: bloomDay = [1,10,3,10,2], m = 3, k = 1
: Output: 3
: 题目 :
: 花园里面有花
: 在他们的 bloomDay[i] 天开花
: 如果想要有m群 有k个相邻的花 的花丛
: 那么最少需要几天
思路:
1.一样偷看提示发现可以二分搜,我本来第一个corner case判断是写
m * k > bloomDay.length 结果第92个 case 给了一个超大的 m和k
导致溢位WA,结论就是恨py。
java code
作者: JIWP (JIWP)   2023-06-19 16:36:00
大师
作者: oin1104 (是oin的说)   2024-06-19 17:18:00
大师

Links booklink

Contact Us: admin [ a t ] ucptt.com