Flipkart Coding Question – Solved

12 Live
A chat application is building a new immersive feature for their customers to enhance their experience. To train the model for this feature, the developers have prepared a dataset. In the dataset, there are two columns: The first column contains a new search term A (a string written without spaces). The second column contains N unique space-separated words. Task The training model is designed to accept both columns as input and return all feasible sentences after inserting spaces in the search term A, such that: - Each word in the sentence exists in the second column. - A word from the second column can be used multiple times. - Each letter from the search term A must be used in forming the sentence. - The relative positions of the letters in search term A must remain the same in the output. Input Format First line: A string searchTermA, representing the search term A without spacing. Second line: An integer word_size, representing the total number of words in the second column. Third line: N space-separated words, representing the list of words available for sentence formation.

Asked in: Flipkart

Image of the Question

Question Image Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |