Question: In java I have an array of arrays that looks like this. array = [['y', 'c' ,'o' , 'd' ,'e' 'j'], ['h' ,'s' ,'e' ,'y'

In java I have an array of arrays that looks like this.

array = [['y', 'c' ,'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 c 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 (code, ode, cod, ply, jed, doc, yes, spool, loops, loop, way)

I want to check my array to see if it contains valid words. A valid word needs to be three or more letters and also needs to be included in the set. I want to check the grid for words first left to right, then right to left, then top to bottom, then bottom to top. The order that the words are found (1. Left to right 2. Right to left 3. Top to bottom 4. Bottom to top) matters. This grid should return the words:

cod code ode ply jed doc yes spool pool way loop loops

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!