Practice Distribute Repeating Integers
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Hard#1655
LeetCode ProblemDistribute Repeating Integers
Problem Statement
Allocate occurrences from nums to all customers. Customer i must receive exactly quantity[i] occurrences, all having the same value. Each occurrence can be used at most once; unused occurrences are permitted. Return whether every customer can be satisfied.
Source: Distribute Repeating Integers on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [1,2,3,4], quantity = [2]
Output
false
# Example 2
Input
nums = [1,2,3,3], quantity = [2]
Output
true
# Example 3
Input
nums = [1,1,2,2], quantity = [2,2]
Output
true
Constraints
n == nums.length
1 <= n <= 10^5
1 <= nums[i] <= 1000
m == quantity.length
1 <= m <= 10
1 <= quantity[i] <= 10^5
There are at most 50 unique values in nums.
Related LeetCode Problems
Practice more problems similar to Distribute Repeating Integers.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.