-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTRIE Question
More file actions
23 lines (19 loc) · 856 Bytes
/
TRIE Question
File metadata and controls
23 lines (19 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Trie is an efficient information retrieval data structure. Use this data structure to store Strings and search strings. Your task is to use TRIE data structure and search the given string A. If found print 1 else 0.
Input:
The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consists of three lines.
First line of each test case consist of a integer N, denoting the number of element in a Trie to be stored.
Second line of each test case consists of N space separated strings denoting the elements to be stored in the trie.
Third line of each test case consists of a String A to be searched in the stored elements.
Output:
Print the respective output in the respective line.
Constraints:
1<=T<=20
1<=N<=20
Example:
Input:
1
8
the a there answer any by bye their
the
Output:
1