Answered step by step
Verified Expert Solution
Question
1 Approved Answer
what is the python solution to this question? Matrix Challenge Have the function MatrixChallenge ( strArr ) read the array of strings stored in strArr,
what is the python solution to this question?
Matrix Challenge
Have the function MatrixChallengestrArr read the array of strings stored in strArr, which will contain elements: the first element will represent a x matrix of letters, and the second element will be a long string of commaseparated words each at least letters long, in alphabetical order, that represents a dictionary of some arbitrary length. For example: strArr can be: rbfg ukop, fgub, mnry "bog,bop,gup,fur,ruk" Your goal is to determine if all the comma separated words as the second parameter exist in the x matrix of letters. For this example, the matrix looks like the following:
r b f g
u k o p
f g u b
m n r y
The rules to make a word are as follows:
A word can be constructed from sequentially adjacent spots in the matrix, where adjacent means moving horizontally, vertically, or diagonally in any direction.
A word cannot use the same location twice to construct itself.
The rules are similar to the game of Boggle. So for the example above, all the words exist in that matrix so your program should return the string true. If all the words cannot be found, then return a comma separated string of the words that cannot be found, in the order they appear in the dictionary.
Examples
Input: aaey rrum, tgmn ball", "all,ball,mur,raeymnl,tall,true,trum"
Output: true
Input: aaey rrum, tgmn ball", "all,ball,mur,raeymnl,rumk,tall,true,trum,yes"
Output: rumk,yes
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started