Find Consistent Logs

Problem Overview

  • Find the maximum length subarray of event logs that is considered "consistent."
  • A subarray is consistent if its most frequent user’s count equals the least frequent user’s count in the entire array.
  • Input: int array userEvent of size n; Output: int maximum length; Constraints: 1 ≤ n ≤ 3e5, 1 ≤ userEvent[i] ≤ 1e9.
  • Real-world context: analyzing user behavior in a social media app.
  • Citadel interviews 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: