Question bank › Trie
Dsa Trie Easy

Network Path Validator

You are given a list of valid network paths and a series of paths that need to be validated. You need to implement a Trie that will determine if each path starts with any of the valid paths. Input Format: The first line contains an integer n (1 ≤ n ≤ 500), the number of valid paths. The next n lines each contain a valid path. The last line contains an integer m (1 ≤ m ≤ 500), the number of paths to validate. The next m lines each contain a path to validate. Output Format: For each path to validate, print 'VALID' if it starts with a valid path, otherwise print 'INVALID'. Example: Input: 3 /home/user /home/admin /etc/config 3 /home/user/profile /home/guest /etc/config/system Output: VALID INVALID VALID

Key concepts

trienetwork pathsvalidation

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.