Leetcode 2021-07-03
🟡 451.sort-characters-by-frequency
🏷️ Tags
#hash_table #string #bucket_sort #counting #sorting #heap_priority_queue
Description
Given a string
Example
🟡 451.sort-characters-by-frequency
🏷️ Tags
#hash_table #string #bucket_sort #counting #sorting #heap_priority_queue
Description
Given a string
s, sort it in decreasing order based on the frequency of characters, and return the sorted string.Example
Input: s = "tree"
Output: "eert"
Explanation: 'e' appears twice while 'r' and 't' both appear once.
So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer.
Leetcode-cn.com 2021-07-03
🟡 451.sort-characters-by-frequency
🏷️ Tags
#hash_table #string #bucket_sort #counting #sorting #heap_priority_queue
Description
给定一个字符串,请将字符串里的字符按照出现的频率降序排列。
Example
🟡 451.sort-characters-by-frequency
🏷️ Tags
#hash_table #string #bucket_sort #counting #sorting #heap_priority_queue
Description
给定一个字符串,请将字符串里的字符按照出现的频率降序排列。
Example
输入:
"tree"
输出:
"eert"
解释:
'e'出现两次,'r'和't'都只出现一次。
因此'e'必须出现在'r'和't'之前。此外,"eetr"也是一个有效的答案。
692.top-k-frequent-words.pdf
71.5 KB
leetcode.com 2022-10-19
🟡692.top-k-frequent-words
🏷️ Tags
#hash_table #string #trie #sorting #heap_priority_queue #bucket_sort #counting
🟡692.top-k-frequent-words
🏷️ Tags
#hash_table #string #trie #sorting #heap_priority_queue #bucket_sort #counting
451.sort-characters-by-frequency.pdf
67.4 KB
leetcode.com 2022-12-03
🟡451.sort-characters-by-frequency
🏷️ Tags
#hash_table #string #sorting #heap_priority_queue #bucket_sort #counting
🟡451.sort-characters-by-frequency
🏷️ Tags
#hash_table #string #sorting #heap_priority_queue #bucket_sort #counting
912.sort-an-array.pdf
58.9 KB
leetcode.com 2023-03-01
🟡912.sort-an-array
🏷️ Tags
#array #divide_and_conquer #sorting #heap_priority_queue #merge_sort #bucket_sort #radix_sort #counting_sort
🟡912.sort-an-array
🏷️ Tags
#array #divide_and_conquer #sorting #heap_priority_queue #merge_sort #bucket_sort #radix_sort #counting_sort
leetcode.com 2023-05-22
🟡347.top-k-frequent-elements
🏷️ Tags
#array #hash_table #divide_and_conquer #bucket_sort #counting #quickselect #sorting #heap_priority_queue
🟡347.top-k-frequent-elements
🏷️ Tags
#array #hash_table #divide_and_conquer #bucket_sort #counting #quickselect #sorting #heap_priority_queue
Telegraph
top-k-frequent-elements
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Input: nums = [1], k = 1 Output: [1] Constraints: