Trie | (Delete)
Submissions: 1671   Accuracy:

8.34%

  Difficulty: Medium   Marks: 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. And if the string is deleted successfully than 1 will be printed.

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

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.