Flipkart Coding Question – Solved

11 Live
1. Simple Text Queries In this challenge, you will be given an array of sentences and an array of queries. Determine which sentences contain all of the words of a query. If no sentence contains all of the words, the answer to that query is [-1]. Example: sentences = ['bob and alice like to text each other', 'bob does not like to ski but does not like to fall', 'Alice likes to ski'] queries = ['bob alice', 'alice', 'like', 'non occurrence'] The results of the queries are: 0. sentences[0] -> [0] 1. sentences[0] -> [0] 2. sentences[0], sentences[1], sentences[1] -> [0, 1, 1] 3. none match -> [-1] Return a 2-dimensional integer array: [[0], [0], [0, 1, 1], [-1]]. Note: The word "like" in queries[2] does not match "likes" in sentences[2]. The word "alice" does not match "alice" in sentence[2]. Matches must be exact. After each query has been processed, add an array of indices of the matching sentences to the answer.

Asked in: Flipkart

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| The supply chain manager at one of Amazon's warehouses is shipping the last con… |
| Determine the highest value after executing n steps on an infinite 2D grid that… |
| Amazon Prime Video is developing a new feature called "Segmentify." This featur… |
| In this new stock prediction game launched on Amazon Games, Player 1 provides P… |
| Amazon operates numerous warehouses, with each warehouse holding inventory[i] u… |
| In Amazon's highly efficient logistics network, minimizing operational overhead… |