I had thought that the condition is "number of flowers that are not blooming between the two blooming flowers is k", because the level of the question is hard. But I was wrong.
[1,7,5,6,4,3,2,1], k = 5
In the day 3, the status of the flowers is
[1, 0, 0, 0, 0, 1, 0, 1]
So the number of flowers that are not blooming between flower 1 and flower 7 is 5.
The answer will be 3.
But how to solve it if the question is exactly in this way?
Does anybody have an idea?
I think questions says "there exists two flowers in the status of blooming".
So as you move each day, you need to find if there are any two flowers which are bloomed, and all flowers in between them is unbloomed. And if these unbloomed flowers count = k.
Yes, and that‘s why I said the question is not matched with the level "hard".
There must be someone who considered the question in the same way as mine, the question is misleading for me.
Now I want to solve this new question.
What if "the K flowers" are allowed to be separated by blooming flowers?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.