Similar to this question, but this is a crossword variation!
Instead of only one letter per grid square, you can have one or two.
Input:
- A 2d array, or whatever works in your language.
- You can assume valid inputs
- Any array size must work
Output:
- An array of all the words
- Across and down
- All words must be joined together, i.e. linked in an unbroken chain of words (if not return false)
- Words must be at least two grid squares, not letters
Example:
[["", "wo", "r", "k"],
[ "", "r", "", ""],
[ "he", "l", "lo", ""],
[ "", "d", "ad", ""]]
Returns:
["work", "world", "hello", "load", "dad"]
Example:
[["he", "ll", "o"],
[ "", "", ""],
[ "wo", "r", "ld"]]
Returns:
false
This is fastest-code, so I'll be running this on windows 7 with 2.5ghz and 16gb of ram. If your code is really esoteric, provide a link to the compiler so I can actually run it.