Problem Statement | |||||||||||||
You've been given the task of designing part of a circuit board. You need to connect as many data lines as possible from the top edge of the board to the bottom edge of the board. However, there are a number of screwholes already in place that cannot be moved and will need to be avoided. layout will contain the current layout of the board, formatted like the example below, with '.' for open spaces and 'o' for screwholes:
.o.ooo.. o....... .....ooo ........ .o.oo... The data lines must be kept short; this means they cannot go sideways or backwards on the board. They start at the top row, and at each step they must go either straight down, down and one cell to the right, or down and one cell to the left. Two data lines cannot occupy the same cell. In the example above, we can fit in 3 data lines by laying them out like this: \o|ooo/. o||../.. ./|.|ooo |.|.\... |o|oo|.. Return the maximum number of complete data lines that can be placed on the board. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | layout will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of layout will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | Each element of layout will contain the same number of characters. | ||||||||||||
- | Each element of layout will contain only the characters '.' or lowercase 'o'. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|