Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number of Operations to Have Distinct Elements

Try to solve the Minimum Number of Operations to Have Distinct Elements problem.

Statement

You are given an integer array nums.

In one operation, you can remove the first 33 elements of nums. If nums contains fewer than 33 elements, all remaining elements are removed.

You repeat this operation until all elements in nums are distinct.

Return the minimum number of operations needed to make all elements in nums distinct.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number of Operations to Have Distinct Elements

Try to solve the Minimum Number of Operations to Have Distinct Elements problem.

Statement

You are given an integer array nums.

In one operation, you can remove the first 33 elements of nums. If nums contains fewer than 33 elements, all remaining elements are removed.

You repeat this operation until all elements in nums are distinct.

Return the minimum number of operations needed to make all elements in nums distinct.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5