Sort characters in string by frequency using heap or bucket sort
Find the k most frequent elements in an array