Back to the 100
Course Practice
Hard

K Empty Slots

LAB

Flowers bloom in the given order by position. Return the earliest day when two blooming flowers have exactly k unbloomed slots between them, or -1.

EXAMPLES

Example 1
Input
{
  "flowers": [
    1,
    3,
    2
  ],
  "k": 1
}

Output
2

FUNCTION SHAPE

flowers: intArrayk: intint
00:00
3 local tests readyRun with ⌘/Ctrl + Enter. Your code stays in this browser.

Runs solve(...) locally in a browser worker. SWE Playbook does not submit your code. Only run code you trust; Python code may access the network.