Skip to content

Commit 4c4c914

Browse files
add 3014
1 parent ac6e627 commit 4c4c914

File tree

2 files changed

+25
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src/main/java/com/fishercoder/solutions/fourththousand

2 files changed

+25
-0
lines changed

paginated_contents/algorithms/4th_thousand/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
| 3042 | [Count Prefix and Suffix Pairs I](https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3042.java) | | Easy |
3232
| 3038 | [Maximum Number of Operations With the Same Score I](https://leetcode.com/problems/maximum-number-of-operations-with-the-same-score-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3038.java) | | Easy |
3333
| 3033 | [Modify the Matrix](https://leetcode.com/problems/modify-the-matrix/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3033.java) | | Easy |
34+
| 3014 | [Minimum Number of Pushes to Type Word I](https://leetcode.com/problems/minimum-number-of-pushes-to-type-word-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3014.java) | | Easy |
3435
| 3006 | [Find Beautiful Indices in the Given Array I](https://leetcode.com/problems/find-beautiful-indices-in-the-given-array-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3006.java) | | Medium |
3536
| 3005 | [Count Elements With Maximum Frequency](https://leetcode.com/problems/count-elements-with-maximum-frequency/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3005.java) | | Easy |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.fishercoder.solutions.fourththousand;
2+
3+
public class _3014 {
4+
public static class Solution1 {
5+
int KEY_COUNT = 8;
6+
7+
public int minimumPushes(String word) {
8+
int times = 1;
9+
int pushes = 0;
10+
int len = word.length();
11+
while (len > 0) {
12+
if (len < KEY_COUNT) {
13+
pushes += times * len;
14+
return pushes;
15+
} else {
16+
pushes += times * KEY_COUNT;
17+
len -= KEY_COUNT;
18+
times++;
19+
}
20+
}
21+
return pushes;
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)