mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>You are given an array <code>nums</code> consisting of <strong>positive</strong> integers.</p>
 | 
						|
 | 
						|
<p>Return <em>the <strong>total frequencies</strong> of elements in</em><em> </em><code>nums</code> <em>such that those elements all have the <strong>maximum</strong> frequency</em>.</p>
 | 
						|
 | 
						|
<p>The <strong>frequency</strong> of an element is the number of occurrences of that element in the array.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong class="example">Example 1:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> nums = [1,2,2,3,1,4]
 | 
						|
<strong>Output:</strong> 4
 | 
						|
<strong>Explanation:</strong> The elements 1 and 2 have a frequency of 2 which is the maximum frequency in the array.
 | 
						|
So the number of elements in the array with maximum frequency is 4.
 | 
						|
</pre>
 | 
						|
 | 
						|
<p><strong class="example">Example 2:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> nums = [1,2,3,4,5]
 | 
						|
<strong>Output:</strong> 5
 | 
						|
<strong>Explanation:</strong> All elements of the array have a frequency of 1 which is the maximum.
 | 
						|
So the number of elements in the array with maximum frequency is 5.
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong>Constraints:</strong></p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li><code>1 <= nums.length <= 100</code></li>
 | 
						|
	<li><code>1 <= nums[i] <= 100</code></li>
 | 
						|
</ul>
 |