Question bank › Hashing
Dsa Hashing Hard

Online Store Product Search

You are building a product search feature for an online store. Given a list of product names, you need to perform search operations based on a series of query strings and return the number of products that match each query. A product matches a query if the query string is a substring of the product name. Input Format: - The first line contains an integer n (1 <= n <= 10000): number of product names. - The next n lines contain product names. - The next line contains an integer m (1 <= m <= 1000): number of queries. - The next m lines contain query strings. Output Format: - Print the number of matches for each query on a new line. Example: Input: 3 Apple MacBook Pro Dell XPS 15 HP Spectre x360 2 Apple Dell Output: 1 1

Key concepts

hashingsearchingdatabases

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.