Find Maximum Maxima Count

Problem Overview

  • Given a string of lowercase categories, compute for each character how many prefix indices have it as the maximal frequency, then return the largest such count (maximum MaximaCount).
  • Input: string categories (length <= 1e5, lowercase); Output: integer maximum MaximaCount.
  • Context: models a customer's purchased item categories over time for behavior analysis via prefixes.
  • Source: Amazon interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: