Link: https://leetcode.com/problems/minimum-number-of-pushes-to-type-word-ii/
Solution:
Intuition
Quite a simple problem…not much to it. Basically, the key insight is that the words should be prioritized by frequency. So more frequent words deserve higher placement in the mapping. The implementation is somewhat trivial. We can also use heap but there is no point.
Implementation
Review 1
Nice problem. Spent a minute on computing the right number of presses. The above is nice and simple. You can also use (i+8)//8