Problem Statement | |||||||||||||
We have a rectangular castle. The first floor is protected by some number of guards. We want to have at least one guard in each row and in each column. You are given a String[] castle. The j-th character of the i-th element of castle is either '.' (free cell) or uppercase 'X' (guard). Return the smallest number of additional guards we have to place in the castle to achieve our goal. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | castle will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of castle will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | All elements of castle will contain the same number of characters. | ||||||||||||
- | Each character of each element of castle will be either '.' or uppercase 'X'. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|