Query strings suffix comparison

Revision en2, by nguyenquocthao00, 2024-04-25 17:39:04

Given 2 strings s1 and s2, and a list of queries. Each query has 2 values: i,j; for each query you need to check if s1[i:] >= s2[j:].
For example:
s1 = "abababaa"
s2 = "abababab"
Query 0,0 => false
Query 0,2 => true
Query 2,0 => false
How to do this efficiently?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English nguyenquocthao00 2024-04-25 17:39:04 119
en1 English nguyenquocthao00 2024-04-25 17:27:37 199 Initial revision (published)