← 返回 meta 的题目列表Maze Problem with Bug Fix and Extensions
类型:online_judge
Given a maze with an entrance, an exit, walls, and open areas where movement is allowed:
Identify and fix a bug in the existing code so it can pass all test cases.
Solve the issue of BFS timing out by locating and fixing the bug.
Implement a conveyor belt feature that allows moving through walls.
Implement doors and keys in the maze, where a key must be collected to go through a corresponding door.
Input Description
The maze is a 2D character array containing 'S' (start), 'E' (end), '#' (wall), ' ' (open area), 'T' (conveyor belt), 'D' (door), 'K' (key).
Output Description
Return the minimum number of steps needed to travel from the start to the end if possible; otherwise, return -1.
Sample Input
S #
# E
Sample Output
3
Example
Input
S #
# E