MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / query

Function query

Data Structures/Persistent Trie.cpp:47–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47int query(pnode v, int x, int l) {
48 int ans = 0;
49 for (int i = K - 1; i >= 0; --i) {
50 int bit = (x >> i) & 1;
51 if (v->to[bit]->go(l)) { // checking if this bit was inserted before the range
52 ans |= 1 << i;
53 v = v->to[bit];
54 } else {
55 v = v->to[bit ^ 1];
56 }
57 }
58 return ans;
59}
60
61void solve() {
62 int n, q;

Callers 1

solveFunction · 0.70

Calls 1

goMethod · 0.45

Tested by

no test coverage detected