Skip to content

Commit 1b1e092

Browse files
authored
Update stone-game-v.cpp
1 parent 93613df commit 1b1e092

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/stone-game-v.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Solution {
1111
vector<vector<int>> mid(n, vector<int>(n));
1212
for (int l = 1; l <= n; ++l) {
1313
for (int i = 0; i <= n - l; ++i) {
14-
int j = i + l - 1;
14+
const int j = i + l - 1;
1515
int p = (l == 1) ? i + 1 : mid[i][j - 1];
1616
while (prefix[p] - prefix[i] < prefix[j + 1] - prefix[p]) {
1717
++p; // Time: O(n^2) in total
@@ -28,7 +28,7 @@ class Solution {
2828
vector<vector<int>> dp(n, vector<int>(n));
2929
for (int l = 2; l <= n; ++l) {
3030
for (int i = 0; i <= n - l; ++i) {
31-
int j = i + l - 1;
31+
const int j = i + l - 1;
3232
const auto& p = mid[i][j];
3333
int max_score = 0;
3434
if (prefix[p] - prefix[i] == prefix[j + 1] - prefix[p]) {

0 commit comments

Comments
 (0)