Dictionary Usage 2 - Java
Easy Accuracy: 56.92% Submissions: 369 Points: 2

Given a dictionary of n words. You have to display the size of dictionary before and after.

Input Format:
The first line of input contains T denoting thr number of testcases. T testcases follow. Each testcase contains 4 lines of input. The first line contains the number of words n. The second line contains the n  page numbers separated by space. The third line contains n words separated by space. The ith index of word array corresponds to ith index of page numbers array. . The 4th line contains pagenumber x.

Output Format:
For each testcase, in a new line, print the required answer.

Your Task:
Since this is a function problem, you don't need to take any input. Your task is to complete the two functions -  Dictionary() which accepts dictionary, and sizeAfterRemoval() which accepts dictionary and the page number. You have to display the word at that page and evaluate the size after removing the word at the specified page.

Constraints:
1 <= T <= 100
1 <= n <= 1000

Examples:
1
5
123 456 500 550 600
study reference learn code practice
600
Output:

Size before removing word: 5
Word removed from dictionary: practice
Size after removing word: 4

Explanation:
Testcase1:
Initially we have 5 words, so size is 5.  Then we remove the words that is mapped to page number 600. Now size becomes 4.

 

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.