Tap here to switch tabs
Problem
Submissions

Problem: Find the Most Common Response

med
30 min
Try to solve the Find the Most Common Response problem.

Statement

Given a two dimensional array of strings responses, where each responses[i] represents a collection of responses.

A response is counted at most 11 time per list responses[i], even if it appears multiple times within that same list.

Return the response string that appears in the maximum number of lists. If there is a tie, return the lexicographically smallest response string.

Constraints:

  • 1≤1 \leq responses.length ≤1000\leq 1000

  • 1≤1 \leq responses[i].length ≤1000\leq 1000

  • 1≤1 \leq responses[i][j].length ≤10\leq 10

  • responses[i][j] consists of only lowercase English letters

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Most Common Response

med
30 min
Try to solve the Find the Most Common Response problem.

Statement

Given a two dimensional array of strings responses, where each responses[i] represents a collection of responses.

A response is counted at most 11 time per list responses[i], even if it appears multiple times within that same list.

Return the response string that appears in the maximum number of lists. If there is a tie, return the lexicographically smallest response string.

Constraints:

  • 1≤1 \leq responses.length ≤1000\leq 1000

  • 1≤1 \leq responses[i].length ≤1000\leq 1000

  • 1≤1 \leq responses[i][j].length ≤10\leq 10

  • responses[i][j] consists of only lowercase English letters