Trains the technique from
LeetCode 1482Minimum Number of Days to Make m BouquetsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A solar field is built as one long row of panels. readyDay[i] is the day panel i is energised; the panel carries nothing before that day and stays energised from that day onwards.
The field is commissioned in strings. A string is k panels that sit next to each other in the row and are all energised, and a panel may be wired into at most one string.
Return the earliest day on which m strings can be picked out of the row at once. If the row can never supply m strings, return -1. Every readyDay[i] is at least 1, so -1 cannot be confused with a real day.
Example 1
On day 4 the only panel still dark is panel 2, so panels 0 and 1 make one string and panels 3 and 4 make the other, leaving panel 5 spare.
Example 2
Panels 2 and 3 are both energised on day 2 and sit next to each other, which is the one string the field asks for.
Example 3
Two strings of two panels would take four panels in all and the row holds only two, so no day supplies them.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def earliest_commission_day(readyDay: list[int], m: int, k: int) -> int:public int earliestCommissionDay(int[] readyDay, int m, int k)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.