DIY: Walls and Gates
Explore how to solve the Walls and Gates problem by writing a Kotlin function that fills each empty room in a grid with the distance to its nearest gate. Understand handling walls and obstacles, and practice a real-world coding interview scenario from Amazon challenges.
We'll cover the following...
We'll cover the following...
Problem
You are given a grid represented by a 2D array named rooms. The grid represents rooms where a cell can either be a wall, a gate, or an empty space. The rooms are initialized with these three possible values.
| Values | Represents |
|---|---|
| A wall or an obstacle | |