3016-minimum-number-of-pushes-to-type-word-ii

DevGod
Vtuber
/** * @param {string} word * @return {number} */var minimumPushes = function(word) { let score = 0; let freqMap = _.orderBy(_.countBy(word), [], ['desc']); _.forEach(freqMap, (value, key) => score += value*(Math.floor(key/8)+1)); return score;};
class Solution: def minimumPushes(self, word: str) -> int: myCounter = Counter(word).most_common()
score = 0 for i, (key, val) in enumerate(myCounter): score += val * (int(i / 8) + 1)
return score