Company: Corridor platforms IITM
Difficulty: medium
Sum of Lengths of Lexicographically Smallest Substrings Problem Description Given a string S of size N , and Q queries. For each query, you are provided with a query string T . For each query, you need to perform the following steps: Identify all substrings of S that start with the query string T . Among these identified substrings, find the one that is lexicographically smallest. Record the length of this lexicographically smallest substring. The final answer to the problem should be the sum of all recorded lengths across all Q queries. Examples No examples provided in the original problem statement. Constraints N < 10^5 Q < 10^5 T.length() <= 10