mathsjery
JF-Expert Member
- Sep 26, 2015
- 2,287
- 1,855
Given a rectangular grid of characters, print the longest string that forms a lexicographically ordered path through the grid.
- Characters are between " (ascii 32) and " (ascii 126) inclusively.
- The rows of the grid are separated by newlines (ascii 10) and should not be interpreted as characters in the grid.
- Paths will not necessarily be sequential (characters can be skipped).
- They can start and end anywhere in the grid.
- They can change directions at any time, go in any direction, diagonally, or even cross themselves.
- If there's a tie for longest, return the path that comes first lexicographically.