Problem Statement | |||||||||||||
You are given a String[] maze, where the j-th character of the i-th element describes the cell at row i, column j. '#' denotes a wall, '.' denotes an empty space, and 'R' denotes an empty space where you have the option of placing a single robot at time 0. The maze is surrounded on all four sides by walls. Each robot in the maze executes the same program starting at time 0. The program consists of a sequence of commands, where each command is one of the four cardinal directions (up, down, left or right). When a robot executes a command, it attempts to move one cell in the direction specified by the command. If the destination cell is a wall, the robot will not move. Multiple robots are allowed to occupy the same cell at the same time. Each command takes exactly 1 second regardless of whether or not the robot moves. Your goal is to write a program that will enable to you place as many robots as possible into 'R' cells such that all of them will end up in the same cell when the program finishes. Return this maximum possible number of robots. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | maze will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of maze will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | Each character in maze will be '#', '.' or 'R'. | ||||||||||||
- | Each element of maze will contain the same number of characters. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|