MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / lcp

Method lcp

code/strings/suffix_array.cpp:19–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 L[i].nr == L[i - 1].nr ? P[stp][L[i - 1].p] : i; }
18 rep(i,0,n) idx[P[(int)size(P) - 1][i]] = i; }
19 int lcp(int x, int y) {
20 int res = 0;
21 if (x == y) return n - x;
22 for (int k = (int)size(P)-1; k >= 0 && x<n && y<n; k--)
23 if (P[k][x] == P[k][y])
24 x += 1 << k, y += 1 << k, res += 1 << k;
25 return res; } };
26// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected