We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 93613df commit 1b1e092Copy full SHA for 1b1e092
C++/stone-game-v.cpp
@@ -11,7 +11,7 @@ class Solution {
11
vector<vector<int>> mid(n, vector<int>(n));
12
for (int l = 1; l <= n; ++l) {
13
for (int i = 0; i <= n - l; ++i) {
14
- int j = i + l - 1;
+ const int j = i + l - 1;
15
int p = (l == 1) ? i + 1 : mid[i][j - 1];
16
while (prefix[p] - prefix[i] < prefix[j + 1] - prefix[p]) {
17
++p; // Time: O(n^2) in total
@@ -28,7 +28,7 @@ class Solution {
28
vector<vector<int>> dp(n, vector<int>(n));
29
for (int l = 2; l <= n; ++l) {
30
31
32
const auto& p = mid[i][j];
33
int max_score = 0;
34
if (prefix[p] - prefix[i] == prefix[j + 1] - prefix[p]) {
0 commit comments