Pocket Gems interview question

Top K most frequent numbers in a array. Follow-up, in a stream. Implement strStr().