Free written solutionMinimum Number of Pushes to Type Word I (LeetCode 3014): Solution and Explanation
You may remap distinct lowercase letters onto the 8 phone keys 2 to 9, and the kth letter on a key costs k pushes. Return the fewest pushes needed to type word.
Read the intuition, approach, code and complexity →