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
void insert(String key, int val) Inserts the key-val pair into the map. If the key already existed, the original key-value pair will be overridden to the new one.
8
+
int sum(string prefix) Returns the sum of all the pairs' value whose key starts with the prefix.
Given a non-empty list of words, return the k most frequent elements.
5
+
6
+
Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word with the lower alphabetical order comes first.
7
+
8
+
Example 1:
9
+
Input: ["i", "love", "leetcode", "i", "love", "coding"], k = 2
10
+
Output: ["i", "love"]
11
+
Explanation: "i" and "love" are the two most frequent words.
12
+
Note that "i" comes before "love" due to a lower alphabetical order.
0 commit comments