Skip to content

Commit 82baf8a

Browse files
Merge pull request #13 from theforestvn88/august
3016
2 parents 4423748 + c4bd3c1 commit 82baf8a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# @param {String} word
2+
# @return {Integer}
3+
def minimum_pushes(word)
4+
counter = word.chars.tally
5+
sorted = counter.values.sort
6+
sorted.reverse.each_with_index.reduce(0) { |sum, (count, i)|
7+
sum += (i/8 + 1) * count
8+
}
9+
end

0 commit comments

Comments
 (0)