Skip to content

Commit e1e1f48

Browse files
authored
Update maximum-difference-between-even-and-odd-frequency-ii.cpp
1 parent ebaa68d commit e1e1f48

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

C++/maximum-difference-between-even-and-odd-frequency-ii.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ class Solution {
1919
vector<vector<int>> mn(2, vector<int>(2, POS_INF));
2020
for (int right = k - 1, left = 0; right < size(s); ++right) {
2121
for (; k <= right - left + 1 && prefix1[right + 1] - prefix1[left] && prefix2[right + 1] - prefix2[left]; ++left) {
22-
const int x = prefix1[left] % 2;
23-
const int y = prefix2[left] % 2;
24-
mn[x][y] = min(mn[x][y], prefix[left]);
22+
const int i = prefix1[left] % 2;
23+
const int j = prefix2[left] % 2;
24+
mn[i][j] = min(mn[i][j], prefix[left]);
2525
}
26-
const int x = prefix1[right + 1] % 2;
27-
const int y = prefix2[right + 1] % 2;
28-
if (mn[x ^ 1][y] != POS_INF) {
29-
result = max(result, prefix[right + 1] - mn[x ^ 1][y]);
26+
const int i = prefix1[right + 1] % 2;
27+
const int j = prefix2[right + 1] % 2;
28+
if (mn[i ^ 1][j] != POS_INF) {
29+
result = max(result, prefix[right + 1] - mn[i ^ 1][j]);
3030
}
3131
}
3232
return result;

0 commit comments

Comments
 (0)