What is your solution?
Do your homework by yourself.
>>2
It's not homework.
Please stop saying so everytime someone posts a puzzle.
Figured it out bishes. I actually thought it was wrong in the beginning, but then I found out my word list didn't have the right words for bishop after I looked up the solution for bishop. Unfortunately, this is pretty inefficient, but it is better than brute force. I think around O(m n^2) where m is the number of letters in the word and n is the number of words in the dictionary.
Given word w_i, length m. (ie. w_1 is the first letter, w_2 is second letter, and so on)
We make a graph with the words as vertices and we try to find a path that would make up the square matrix.
Read all words from dictionary into sets of vertices A_i s.t
every word is length m, the set A_i has words starting with w_i.
Add edges between vertices in set A_i and A_{i+1} if x is in A_i and y is in A_{i+1}, x_{i+1} = y_i.
The idea is that we make a tree with root "bishop" and every edge we form only forms when they might fit into the matrix. It does not necessarily fit into the matrix.
Do BFS from root and find all paths of length m. A path is a potential square matrix.
Check all of the paths (square matrices) to see if any one is symmetric. If there is such a path then found it. Else we did not.
bishop
inhere
shrewd
heeled
orwell
peddle
bishop
intime
stores
hirsle
omelet
peseta
bishop
incase
schrod
harari
osorno
pedion
bishop
iwwort
swiple
hopper
orlean
pterna