BackmediumUncategorized uncategorized medium

Count Complete Groups Solution

Problem Statement

Given a list of integers `groupSizes` where each integer represents the size of a group and a list of integers `identifiers` representing the identifier of each item, determine the total number of groups that can be completely filled with unique items.

Example 1
Input
[2, 3, 1, 2, 2, 3]
Output
2

Explanation: There are two shelves that can be completely filled with unique tomes: one shelf of size 3 and one shelf of size 2 with one tome left over.

Constraints

  • 1 <= groupSizes.length <= 10^5
  • 1 <= identifiers.length <= 10^5
  • 1 <= groupSizes[i] <= 10^3
  • 1 <= identifiers[i] <= 10^3
  • The total number of items does not exceed 10^6
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free