Question: In java I have this array = [['y', 'n' ,'o' , 'd' ,'e' 'j'], ['h' ,'s' ,'e' ,'y' 'p' 'k'], ['l' ,'p' ,'h' ,'b' ,'w'

In java I have this array = [['y', 'n' ,'o' , 'd' ,'e' 'j'], ['h' ,'s' ,'e' ,'y' 'p' 'k'], ['l' ,'p' ,'h' ,'b' ,'w' ,'a'], ['l' ,'o' ,'b' ,'w' ,'x' ,'z'], ['w' ,'o', 'b' ,'a' ,'a' ,'i'], ['p', 'l' ,'y' ,'y' ,'c' ,'g']

It represents this word search grid:

y n o d e j h s e y p k l p h b w a l o b w x z w o b a a i p l y y c g

I have this set that contains the words (node, ode, nod, ply, jed, doc, yes, spool, loops, loop, way)

The minimum word length is 3 letters.

I want to search left to right across the grid to find valid words. A word is valid if it meets the minimum word length and is also in the given set. I want to add the words that I found in a list and return them in the order they were found. You should begin at the first letter and check the word length to the end to see if a word is formed. On the top row ['y','n','o','d','e','j'] the words 'nod', 'node', and then 'ode' are found. Then continue to the next letter. For example, this one should return:

nod

node

ode

ply

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!