Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fd3a747

Browse files
[LEET-848] update 828
1 parent 0605e0c commit fd3a747

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

‎src/main/java/com/fishercoder/solutions/firstthousand/_848.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
public class _848 {
44
public static class Solution1 {
55
public String shiftingLetters(String s, int[] shifts) {
6-
long[] preSums =
7-
new long[shifts.length]; // use long type to avoid integer addition overflow
6+
long[] preSums = new long[shifts.length]; // use long type to avoid integer addition overflow
87
for (int i = shifts.length - 1; i >= 0; i--) {
98
if (i < shifts.length - 1) {
109
preSums[i] = preSums[i + 1] + shifts[i];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package com.fishercoder.solutions.fourththousand;public class _3304 {
2+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.fourththousand;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import com.fishercoder.solutions.fourththousand._3185;
6+
import org.junit.jupiter.api.BeforeEach;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class _3185Test {
10+
private _3185.Solution1 solution1;
11+
12+
@BeforeEach
13+
public void setup() {
14+
solution1 = new _3185.Solution1();
15+
}
16+
17+
@Test
18+
public void test1() {
19+
assertEquals(2, solution1.countCompleteDayPairs(new int[] {12, 12, 30, 24, 24}));
20+
}
21+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /