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 2eb1647 commit f837138Copy full SHA for f837138
C++/count-pairs-with-xor-in-a-range.cpp
@@ -23,7 +23,7 @@ class Solution {
23
continue;
24
}
25
if (dp.count((x ^ 1) ^ k)) {
26
- result += v * dp[(x ^ 1) ^ k]; // current limit is 00001, count xor pair with 00000***** pattern
+ result += v * dp[(x ^ 1) ^ k]; // current limit is 0...01*****, count xor pair with 0...00***** pattern
27
28
29
dp = move(new_dp);
@@ -72,7 +72,7 @@ class Solution2 {
72
int bit = (limit >> i) & 1;
73
if (bit) {
74
if (nodes[idx][curr]) {
75
- result += nodes[nodes[idx][curr]][2]; // current limit is 00001, count xor pair with 00000***** pattern
+ result += nodes[nodes[idx][curr]][2]; // current limit is 0...01*****, count xor pair with 0...00***** pattern
76
77
78
if (!nodes[idx][bit ^ curr]) {
0 commit comments