Leaderboard
Showing:
Handle Score
@Ibrahim Nash 5725
@blackshadows 5685
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
Complete Leaderboard
Trie | (Delete)
Medium Accuracy: 14.59% Submissions: 3067 Points: 4

Trie is an efficient information retrieval data structure. This data structure is used to store Strings and search strings, String stored can also be deleted so, Your task is to complete the function deleteKey to delete the given string A.The String A if exists in the larger String, must be deleted from Trie. Larger string contains space separated small strings. And if the string is deleted successfully than 1 will be printed.
If any other string other than String A is deleted, you will get wrong answer.

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 ≤200
1≤ N, |A| ≤20

Example:
Input:

1
8
the a there answer any by bye their
the
Output:
1

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Trie | (Delete)

Output Window