Given characters and their frequencies, design a Huffman coding and encode a given string optimally (theoretical problem).
N/A (design question).
N/A.
Example 1:
Input:
0 = "a" 1 = "a" 2 = "a"
Output:
000
Explanation:
Single symbol 'a' — Huffman code is 0, encoded = 000
Example 2:
Input:
0 = "a"
Output:
0
Explanation:
Single symbol single char — code 0
Example 3:
Input:
0 = "a" 1 = "a" 2 = "a" 3 = "a"
Output:
0000
Explanation:
Single symbol 4 times — 0000