Minimum Directional Path
You are given the layout of a rectangular building with rooms forming a grid. Each room has four doors to the room to the north, east, south, and west where exactly one door is unlocked and the other three doors are locked. In each time step, you can move to an adjacent room via an unlocked door.
Your task is to determine the minimum number of time steps required to get from the northwest corner to the southeast corner of the building.
Note: If the path doesn’t lead you to exit return
The input is given as:
- a non-empty 2d-array of letters
- ‘building’ represents the open door at the northwest corner.
- The rows of this array are associated with the north-south direction.
- The columns are associated with the east-west direction.
Expected Output: 6Next question: Insurance Leads