MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / bfs

Function bfs

javascript/0286-walls-and-gates.js:74–80  ·  view source on GitHub ↗
(rooms, queue)

Source from the content-addressed store, hash-verified

72};
73
74const bfs = (rooms, queue) => {
75 while (!queue.isEmpty()) {
76 for (let i = queue.size() - 1; 0 <= i; i--) {
77 checkNeighbors(rooms, queue);
78 }
79 }
80};
81
82const checkNeighbors = (rooms, queue) => {
83 const [rows, cols] = [rooms.length, rooms[0].length];

Callers 1

wallsAndGatesFunction · 0.70

Calls 3

checkNeighborsFunction · 0.70
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected