Tap here to switch tabs
Problem
Submissions

Problem: Find the Most Common Response

Find the Most Common Response asks you to return the string present in the most lists. Count each response once per list, then use the lexicographically smallest string to break ties.

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

Find the Most Common Response asks you to return the string present in the most lists. Count each response once per list, then use the lexicographically smallest string to break ties.

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