How to do this question

how to do this question

i am thinking on it wait sometime…

Ok, you can solve this problem by following steps:

  1. Create a dp 2D array having 2 states: the current index of the string and the character at the current string which stores the number of characters upto the current string.

  2. take the first query. Count no, of different chars in it.

  3. Apply binary search on the strings to check that whether the strings upto mid contain all characters of the first query or not.

Similarly do for other strings in query.
Now, try to solve this problem.