Practice Maximum Equal Frequency
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given an array nums of positive integers, return the longest possible length of an array prefix of nums, such that it is possible to remove exactly one element from this prefix so that every number that has appeared in it will have the same number of occurrences. If after removing one element there are no remaining elements, it's still considered that every appeared number has the same number of ocurrences (0).
Source: Maximum Equal Frequency on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [2,2,1,1,5,3,3,5]
7
# Example 2
nums = [1,1,1,2,2,2,3,3,3,4,4,4,5]
13
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Equal Frequency.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.