Skip to content

Commit 623bf40

Browse files
Merge pull request #1897 from CodingTestStudy2/염혜정
[염혜정] Day26
2 parents 809d4c3 + 5b7280e commit 623bf40

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// O(n)
2+
3+
class Solution {
4+
public int minimumPushes(String word) {
5+
int cnt = word.length()/8;
6+
int min = (word.length() % 8) * (cnt + 1);
7+
int i = 1;
8+
while (cnt > 0) {
9+
min += (8 * i);
10+
i++;
11+
cnt--;
12+
}
13+
return min;
14+
}
15+
}

0 commit comments

Comments
 (0)