We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ea8e990 commit 9d30967Copy full SHA for 9d30967
src/main/java/com/fishercoder/solutions/_848.java
@@ -3,7 +3,7 @@
3
public class _848 {
4
public static class Solution1 {
5
public String shiftingLetters(String s, int[] shifts) {
6
- long[] preSums = new long[shifts.length];
+ long[] preSums = new long[shifts.length];//use long type to avoid integer addition overflow
7
for (int i = shifts.length - 1; i >= 0; i--) {
8
if (i < shifts.length - 1) {
9
preSums[i] = preSums[i + 1] + shifts[i];
0 commit comments