Question bank › Trie
Dsa Trie Easy

Unique Subword Finder

You are tasked with finding the unique subwords of a given list of words. A subword is derived by removing zero or more characters from the beginning or end of the word, and it should be counted only if it appears in the original list of words. Input Format: - The first line contains an integer n (1 <= n <= 1000), the number of words. - The following n lines contain one word each (1 <= length of word <= 100). Output Format: - Print the total number of unique subwords found in the list of words. Example: Input: 4 apple app pl le Output: 4

Key concepts

triesubwordsunique

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.