Find Maximum Maxima Count π
Amazon has a string of categories of items purchased by a particular customer, each represented as a lowercase English letter. To analyze customer behavior, we define a metric called the MaximaCount of a category. It is the number of indices where the frequency of some category c is maximum among all categories present in the prefix.
More elaboratively, MaximaCount of character, char, representing a category is defined as the number of indices i, such that the frequency of char is maximal in the prefix of the string up to the index i.
Given the string categories, find the maximum MaximaCount among all the categories.
Complete the function findMaximumMaximaCount in the editor.
findMaximumMaximaCount has the following parameter:
string categories: the given string
Returns
int: the maximum MaximaCount
β«βqβͺ π³π ππΈΛβ¬ οΎ1013rd thank you on the way to spike! ΰΌΒ·Λ
1Example 1

2Example 2
3Example 3
Constraints
Limits and guarantees your solution can rely on.
- The length(categories) <= 10^5
- The string categories consists of lowercase English characters only.