You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keeping a dictionary of occurrences when you just want to find one major element is performing extra work.
31
+
You can instead pass through the array once while keeping track of your current major number and any other number is a reason your current major number should be decremented, else increment it.
32
+
Once your current major number's count reaches zero, then it is a reason a new major number takes its place.
0 commit comments