You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: solution/3500-3599/3527.Find the Most Common Response/README_EN.md
+106-4
Original file line number
Diff line number
Diff line change
@@ -72,32 +72,134 @@ tags:
72
72
73
73
<!-- solution:start -->
74
74
75
-
### Solution 1
75
+
### Solution 1: Hash Table
76
+
77
+
We can use a hash table $\textit{cnt}$ to count the occurrences of each response. For the responses of each day, we first remove duplicates, then add each response to the hash table and update its count.
78
+
79
+
Finally, we iterate through the hash table to find the response with the highest count. If there are multiple responses with the same count, we return the lexicographically smallest one.
80
+
81
+
The complexity is $O(L)$, and the space complexity is $O(L)$, where $L$ is the total length of all responses.
0 commit comments