Practice Find the Most Common Response
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 2D string array responses where each responses[i] is an array of strings representing survey responses from the ith day. Return the most common response across all days after removing duplicate responses within each responses[i]. If there is a tie, return the lexicographically smallest response.
Source: Find the Most Common Response on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
responses = [["good","ok","good","ok"],["ok","bad","good","ok","ok"],["good"],["bad"]]
Output
"good"
# Example 2
Input
responses = [["good","ok","good"],["ok","bad"],["bad","notsure"],["great","good"]]
Output
"bad"
Constraints
1 <= responses.length <= 1000
1 <= responses[i].length <= 1000
1 <= responses[i][j].length <= 10
responses[i][j] consists of only lowercase English letters
Related LeetCode Problems
Practice more problems similar to Find the Most Common Response.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.