Question: Write a function that takes a single input, a person's name, and returns a single output, a string array containing the two possible favourite squishmallows.
Write a function that takes a single input, a person's name, and returns a single output, a string array containing the two possible favourite squishmallows.
The squishmallows should be taken from the list squishmallows.txt that is provided alongside this question. All squishmallows have names of the form X the Y and you should return the full name.
To determine the favourite squishmallows you should consider each squishmallow as being named X the Y and then find the squishmallows who's Y part of the name is alphabetically nearest above, and nearest below, the name of the person provided.
So for example if the name is "Ian" you should return Amaro the Hyena", "Glady the Ice Cream" because "Husky" is alphabetically closest to Ian below, and "Ice Cream" is alphabetically closest above.
Some squishmallows were removed from the list to avoid duplicate vocations, or if they did not have a name of the form X the Y We also will not ask for names that are alphabetically before the first Y or after the last.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
