Problem Statement | |||||||||||||
Last night in Eskimo village it snowed heavily, so all the paths between the different igloos have been covered with snow. The mayor wants to help keep the community together and clean up the snow so that you can reach every igloo from all other igloos.
You are given a String[] paths, where character j of element i is 'Y' if there's a path between the ith igloo and the jth igloo, or 'N' otherwise. All paths are bidirectional. Determine the number of different sets of paths that can be cleaned to achieve the mayor's goal, and return this number modulo 10,000. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | paths must have between 1 and 15 elements, inclusive. | ||||||||||||
- | Each element of paths must have exactly n characters, where n is the number of elements of paths. | ||||||||||||
- | Each character in paths must be either 'Y' or 'N'. | ||||||||||||
- | Character i of element i of paths will always be 'N'. | ||||||||||||
- | Character j in row i of paths will be equal to character i in row j of paths. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|