“…Given the lcp and rank arrays of the string S, we can compute its useful LLRs in O(n) time and space. Proof: By Lemma 2, we know if LLR i−1 exists, the right boundary of LLR i is on or after the right boundary of LLR i−1 , for any i ≥ 2, so we can construct the array of useful LLRs in one pass as follows: we calculate each LLR i using Lemma 1, , 8), (7,13), (10,14), (11,17)}, where each useful LLR is a (start, end) tuple, representing the start and ending position of the LLR. By viewing the start and end positions as the x and y coordinates, all the useful LLRs of the example string can be visualized as the dark dots in the figure. (B) Queries for LR 12 11 , LR 14 11 , LR 12 6 and LR 5 5 are visualized by the red, blue, green, and black polylines, numbered A -D , respectively.…”