Given an array of strings words where each word has a length of top, left, right, and bottom.
A word square is valid if it satisfies the following corner constraints:
top[0] == left[0] (top left corner)
top[3] == right[0] (top right corner)
bottom[0] == left[3] (bottom left corner)
bottom[3] == right[3] (bottom right corner)
Return all valid word squares as a list of lists of strings, where each square is represented in the order [top, left, right, bottom]. The results may be returned in any order.
Constraints:
words.length
words[i].length
words[i] consists of only lowercase English letters.
All words[i] are distinct.
Given an array of strings words where each word has a length of top, left, right, and bottom.
A word square is valid if it satisfies the following corner constraints:
top[0] == left[0] (top left corner)
top[3] == right[0] (top right corner)
bottom[0] == left[3] (bottom left corner)
bottom[3] == right[3] (bottom right corner)
Return all valid word squares as a list of lists of strings, where each square is represented in the order [top, left, right, bottom]. The results may be returned in any order.
Constraints:
words.length
words[i].length
words[i] consists of only lowercase English letters.
All words[i] are distinct.