You are in the process of creating a crossword puzzle. You've already designed the board, but now you need to come up with words of various sizes to put in the puzzle. An empty crossword puzzle consists of filled squares ('X') and empty squares ('.'). Here is an example of a board with 5 rows and 6 columns:
X....X X.XX.X ...X.. X.XX.X ..X...
A "slot" of length N is defined as exactly N empty squares in a row, surrounded on either side by either a filled square or the edge of the board. N must be at least 2. There are five horizontal slots in the example puzzle above:
- First row, length = 4
- Third row, length = 3
- Third row, length = 2
- Fifth row, length = 2
- Fifth row, length = 3
Given a String[] board, representing an empty crossword puzzle, and an int size, your method should return the number of horizontal slots in the puzzle that are exactly size characters in length. Each element of board represents one row of the puzzle. |