|
2 | 2 |
|
3 | 3 | import java.util.TreeMap;
|
4 | 4 |
|
5 |
| -/** |
6 |
| - * 1296. Divide Array in Sets of K Consecutive Numbers |
7 |
| - * |
8 |
| - * Given an array of integers nums and a positive integer k, |
9 |
| - * find whether it's possible to divide this array into sets of k consecutive numbers |
10 |
| - * Return True if its possible otherwise return False. |
11 |
| - * |
12 |
| - * Example 1: |
13 |
| - * Input: nums = [1,2,3,3,4,4,5,6], k = 4 |
14 |
| - * Output: true |
15 |
| - * Explanation: Array can be divided into [1,2,3,4] and [3,4,5,6]. |
16 |
| - * |
17 |
| - * Example 2: |
18 |
| - * Input: nums = [3,2,1,2,3,4,3,4,5,9,10,11], k = 3 |
19 |
| - * Output: true |
20 |
| - * Explanation: Array can be divided into [1,2,3] , [2,3,4] , [3,4,5] and [9,10,11]. |
21 |
| - * |
22 |
| - * Example 3: |
23 |
| - * Input: nums = [3,3,2,2,1,1], k = 3 |
24 |
| - * Output: true |
25 |
| - * |
26 |
| - * Example 4: |
27 |
| - * Input: nums = [1,2,3,4], k = 3 |
28 |
| - * Output: false |
29 |
| - * Explanation: Each array should be divided in subarrays of size 3. |
30 |
| - * |
31 |
| - * Constraints: |
32 |
| - * 1 <= nums.length <= 10^5 |
33 |
| - * 1 <= nums[i] <= 10^9 |
34 |
| - * 1 <= k <= nums.length |
35 |
| - * */ |
36 | 5 | public class _1296 {
|
37 | 6 | public static class Solution1 {
|
38 | 7 | public boolean isPossibleDivide(int[] nums, int k) {
|
|
0 commit comments