Company: Corridor Platforms
Difficulty: medium
A Suffix Queries Problem Problem Description You are given a string S of size N . You need to perform multiple queries on this string. For each query, you are given a string T . You must find the length of the lexicographically smallest suffix string of S that starts with T . If no such suffix exists, return 0 . After performing all queries, you must return the sum of the results of all queries. Since the answer can be very large, return it modulo 10^9 + 7 . Complete the suffixQueries function in the editor below. It has the following parameters: S : A STRING representing the given string. query : A STRING ARRAY representing the array of strings for each query. The function must return an INTEGER denoting the sum of results of all the queries modulo 10^9 + 7 . Examples Example 1: Input: S = "mzadpoghyykht" query = ["yk"] Output: 4 Explanation: The string S is "mzadpoghyykht". The query string T is "yk". The only suffix of S that starts with "yk" is "ykht" (starting at index 10). Its le