Movatterモバイル変換


[0]ホーム

URL:


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

Commitd797cde

Browse files
add a solution for 370
1 parent4eb16f0 commitd797cde

File tree

1 file changed

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

1 file changed

+12
-0
lines changed

‎src/main/java/com/fishercoder/solutions/_370.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,16 @@ public int[] getModifiedArray(int length, int[][] updates) {
2323
returnnums;
2424
}
2525
}
26+
27+
publicstaticclassSolution2 {
28+
publicint[]getModifiedArray(intlength,int[][]updates) {
29+
int[]result =newint[length];
30+
for (int[]update :updates) {
31+
for (inti =update[0];i <=update[1];i++) {
32+
result[i] +=update[2];
33+
}
34+
}
35+
returnresult;
36+
}
37+
}
2638
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp