:orphan: Walls and Gates =============== .. highlight:: none Problem ------- https://leetcode.com/problems/walls-and-gates/ .. highlight:: python Pattern ------- Array, Breadth-First Search, Matrix Approaches ---------- .. tab-set:: .. tab-item:: Multi Source BFS **Code** .. literalinclude:: ../problems/medium/walls-and-gates/walls_and_gates__multi_source_bfs.py :language: python :lines: 9- **Test** >>> from walls_and_gates__multi_source_bfs import wallsAndGates >>> rooms = [[2147483647, -1, 0, 2147483647], [2147483647, 2147483647, 2147483647, -1], [2147483647, -1, 2147483647, -1], [0, -1, 2147483647, 2147483647]] >>> wallsAndGates(rooms) >>> rooms [[3, -1, 0, 1], [2, 2, 1, -1], [1, -1, 2, -1], [0, -1, 3, 4]] .. autofunction:: walls_and_gates__multi_source_bfs.wallsAndGates