Skip to content

Commit f82a859

Browse files
[N-0] add skeleton of 683
1 parent 24b6ac5 commit f82a859

File tree

1 file changed

+39
-0
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.fishercoder.solutions;
2+
3+
/**
4+
* 683. K Empty Slots
5+
*
6+
* There is a garden with N slots. In each slot, there is a flower.
7+
* The N flowers will bloom one by one in N days.
8+
* In each day, there will be exactly one flower blooming and it will be in the status of blooming since then.
9+
* Given an array flowers consists of number from 1 to N. Each number in the array represents the place where the flower will open in that day.
10+
* For example, flowers[i] = x means that the unique flower that blooms at day i will be at position x, where i and x will be in the range from 1 to N.
11+
* Also given an integer k, you need to output in which day there exists two flowers in the status of blooming,
12+
* and also the number of flowers between them is k and these flowers are not blooming.
13+
* If there isn't such day, output -1.
14+
15+
Example 1:
16+
Input:
17+
flowers: [1,3,2]
18+
k: 1
19+
Output: 2
20+
Explanation: In the second day, the first and the third flower have become blooming.
21+
22+
Example 2:
23+
Input:
24+
flowers: [1,2,3]
25+
k: 1
26+
Output: -1
27+
28+
Note:
29+
The given array will be in the range [1, 20000].
30+
31+
*/
32+
public class _683 {
33+
34+
public static class Solution1 {
35+
public int kEmptySlots(int[] flowers, int k) {
36+
return -1;
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)