Max Shared Categories

Problem Overview

  • Determine the highest number of common interests any pair of users shares, defined as the greatest integer that divides both users’ counts in this problem.
  • Input: array favoriteCategories of length n (2–10^4) with values 1–10^4; Output: an int representing that maximum shared value.
  • Context: Analyze TikTok users’ favorite content categories to assess shared interests across the network.
  • Source: From TikTok interviews; a classic 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: