Partitioning Array
Example
Example1:
Input:
A:[1, 2, 3, 4]
k = 2
output: true
Explanation:
Then one possible way is to choose the first 2 elements of the array {1, 2} as the first subsequence, the next 2 elements {3, 4} as the next subsquence.So the answer is trueExample2:
Input:
A: [1, 2, 2, 3]
k: 3
output: false
Explanation:
there is no way to partition the array into subsequences such that all subsquences are of length 3 and each element in the array occurs in exactly one subsequece.Hence the answer is false.Last updated