Back to Month
EASY 30 Jul 2026 View on LeetCode

3014. Minimum Number of Pushes to Type Word I

</> Solution

class Solution {
    public int minimumPushes(String word) {
        int n = word.length();
        int totalCost = 0;
        for (int i = 0; i < n; i++) {
            totalCost += (i / 8) + 1;
        }
        return totalCost;
    }
}

TIME COMPLEXITY

O(n)

SPACE COMPLEXITY

O(1)

TOPICS

Greedy Math String