#3527

Find the Most Common Response

medium · 75% accepted · 57 likes · top 86%

array · hash table · string · counting

⊣ practice⊣ open on leetcode ↗

Description

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.

Solution