1655. Distribute Repeating Integers
https://leetcode.com/problems/distribute-repeating-integers
Description
You are given an array of n
integers, nums
, where there are at most 50
unique values in the array. You are also given an array of m
customer order quantities, quantity
, where quantity[i]
is the amount of integers the ith
customer ordered. Determine if it is possible to distribute nums
such that:
The
ith
customer gets exactlyquantity[i]
integers,The integers the
ith
customer gets are all equal, andEvery customer is satisfied.
Return true
if it is possible to distribute nums
according to the above conditions.
Example 1:
Example 2:
Example 3:
Example 4:
Example 5:
Constraints:
n == nums.length
1 <= n <= 105
1 <= nums[i] <= 1000
m == quantity.length
1 <= m <= 10
1 <= quantity[i] <= 105
There are at most
50
unique values innums
.
ac
Last updated