1854. 数组划分III
中文English
给你一个整数数组和一个整数K,请你判断数组是否可以划分为若干大小为k序列,并满足以下条件:
- 数组中的每一个数恰恰出现在一个序列中
- 一个序列中的数都是互不相同的
- 数组中相同元素是被划分到不同序列中的
如何可以划分,返回True,否则返回False。
数组长度小于等于10^5。
样例
例1:
input: array=[1,2,3,4], k = 2
output:true
例2:
input: array=[1,2,2,3], k = 3
output:false