Skip to content

Commit 9d30967

Browse files
add 848
1 parent ea8e990 commit 9d30967

File tree

1 file changed

+1
-1
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class _848 {
44
public static class Solution1 {
55
public String shiftingLetters(String s, int[] shifts) {
6-
long[] preSums = new long[shifts.length];
6+
long[] preSums = new long[shifts.length];//use long type to avoid integer addition overflow
77
for (int i = shifts.length - 1; i >= 0; i--) {
88
if (i < shifts.length - 1) {
99
preSums[i] = preSums[i + 1] + shifts[i];

0 commit comments

Comments
 (0)