I was asked this during a recent phone interview - Given a Dictionary with a word and the weight of a word(frequency, higher is better), like so -