1121. Divide Array Into Increasing Sequences

Given a non-decreasing array of positive integers nums and an integer K, find out if this array can be divided into one or more disjoint increasing subsequences of length at least K.

Input: nums = [1,2,2,3,3,4,4], K = 3
Output: true
Explanation: 
The array can be divided into the two subsequences [1,2,3,4] and [2,3,4] with lengths at least 3 each.
Input: nums = [5,6,6,7,8], K = 3
Output: false
Explanation: 
There is no way to divide the array using the conditions required.

看了题解,贪心思路太妙了,后悔昨天自己没亲自做一下这题,被T3卡到最后,这场比赛有点小遗憾,遗憾就i遗憾吧,至少我打满了。今天的加油啊!

上一篇:【mongo】加减乘除运算


下一篇:HDU多校1003-Divide the Stones(构造)