Dictionary Usage - Java
Submissions: 200   Accuracy:

61.49%

  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork Java

Given two arrays pages and words of size n. The array of pages contains the page numbers and array of words contains n words. You have to map each word corresponding to its page number and you need to find the word that is mapped to page number x. If there is no word on x, print null.

Input Format:
The first line of input contains T denoting thr number of testcases. T testcases follow. Each testcase contains 2 lines of input. The first line contains the number of words n and x. 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. .

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. Just complete the function Dictionary().

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

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

null

Explanation:
Testcase1:

There is no word in the dictionary at page number 600 so it prints null.

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

Author: Soul_xhacker


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.