Meesho Coding Question – Solved

7 Live
Given an array of strings, each of the same length, and a target string, construct the target string using characters from the strings in the given array such that the indices of the characters in the order in which they are used form a strictly increasing sequence. Here the index of a character is the position at which it appears in the string. Note that it is acceptable to use multiple characters from the same string. Determine the number of ways to construct the target string. One construction is different from another if either the sequences of indices they use are different or the sequences are the same but there exists a character at some index such that it is chosen from a different string in these constructions. Since the answer can be very large, return the value modulo (10^9 + 7). Consider an example with n = 3 strings, each of length 3. Let the array of strings be words = ["adc", "aec", "efg"], and the target string target = "ac". There are 4 ways to reach the target: 1. Select the 15t character of "adc" and the 3rd character of "adc". 2. Select the 1st character of "adc" and the 3rd character of "aec". 3. Select the 15t character of "aec" and the 3rd character of "adc". 4. Select the 1st character of "aec" and the 3rd character of "aec".

Asked in: Meesho

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |