Instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 2

DownloadInstructions
Open PDF In BrowserView PDF
Hash Tables: Ransom
Note
Harold is a kidnapper who wrote a ransom note, but now he is worried it will be traced back to him
through his handwriting. He found a magazine and wants to know if he can cut out whole words from it
and use them to create an untraceable replica of his ransom note. The words in his note are casesensitive and he must use only whole words available in the magazine. He cannot use substrings or
concatenation to create the words he needs.
Given the words in the magazine and the words in the ransom note, print Yes if he can replicate his
ransom note exactly using whole words from the magazine; otherwise, print No .
For example, the note is "Attack at dawn". The magazine contains only "attack at dawn". The magazine
has all the right words, but there's a case mismatch. The answer is
.
Function Description
Complete the checkMagazine function in the editor below. It must print
using the magazine, or
.

if the note can be formed

checkMagazine has the following parameters:

magazine: an array of strings, each a word in the magazine
note : an array of strings, each a word in the ransom note
Input Format
The first line contains two space-separated integers,
and the
..
The second line contains
The third line contains

and

, the numbers of words in the

space-separated strings, each

.

space-separated strings, each

.

Constraints

.
Each word consists of English alphabetic letters (i.e.,

to

and

to

).

Output Format
Print Yes if he can use the magazine to create an untraceable replica of his ransom note. Otherwise, print
No .
Sample Input 0
64
give me one grand today night
give one grand today

Sample Output 0
Yes

Sample Input 1

65
two times three is not four
two times two is four

Sample Output 1
No

Explanation 1
'two' only occurs once in the magazine.
Sample Input 2
74
ive got a lovely bunch of coconuts
ive got some coconuts

Sample Output 2
No

Explanation 2
Harold's magazine is missing the word

.



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.4
Linearized                      : No
Title                           : 
Creator                         : wkhtmltopdf 0.12.3
Producer                        : Qt 4.8.7
Create Date                     : 2018:07:10 15:53:06Z
Page Count                      : 2
Page Mode                       : UseOutlines
EXIF Metadata provided by EXIF.tools

Navigation menu