Skip to content

Commit 6b72ba5

Browse files
authored
Update 1224-maximum-equal-frequency.js
1 parent ebb64cb commit 6b72ba5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

1224-maximum-equal-frequency.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ const maxEqualFreq = function (nums) {
2020

2121
maxF = max(maxF, f)
2222

23+
/*
24+
cnt records the occurence of each num, freq records the frequence of number of occurences. max_F is the largest frequence.
25+
There are three cases which satify the condition:
26+
27+
all elements appear exact once.
28+
all elements appear max_F times, except one appears once.
29+
all elements appear max_F-1 times, except one appears max_F.
30+
*/
2331
if(
2432
maxF === 1 ||
2533
maxF * freqCnt[maxF] === i ||

0 commit comments

Comments
 (0)