13
1
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.
9Welcome to PPCG! – FlipTack – 2016-12-18T18:10:45.293
2You should replace the two spaces part with two grid squares. – Gábor Fekete – 2016-12-19T14:04:59.853
1What size input size will the speed be measured with? – Martin Ender – 2016-12-19T14:06:42.980
@MartinEnder the examples – epicbob57 – 2016-12-19T19:14:23.233
@epicbob57 That seems way to small to measure reliable timings. You'd mostly be measuring I/O and other overhead. – Martin Ender – 2016-12-19T19:15:53.190
@MartinEnder All right, I'll work out a better example for testing – epicbob57 – 2016-12-19T19:19:02.113