Skip to content

Commit 5cee8cb

Browse files
committed
Update index.ts
1 parent 3da29ff commit 5cee8cb

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

student-attendance-record-ii/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ function checkRecord(n: number): number {
3232
}
3333
}
3434

35-
let sum = 0;
36-
for (let j = 0; j <= 1; j++) {
37-
for (let k = 0; k <= 2; k++) {
38-
sum = (sum + dp[n][j * 3 + k]) % MOD;
39-
}
40-
}
35+
const sum = dp[n].reduce((a, b) => a + b, 0) % MOD;
4136
return sum;
4237
}
4338
export default checkRecord;

0 commit comments

Comments
 (0)