Subsegment Search

Galib is the best algorithmist in Bangladesh right now! He challenged Faysal who is also an algorithmist to solve this problem but he got stuck. Can you help him?


This is a companion discussion topic for the original entry at https://toph.co/p/subsegment-search