Bug Report for matrixBFS
Opened this issue · 0 comments
hsiwkin commented
Bug Report for [Matrix BFS Problem on NeetCode.io](https://neetcode.io/problems/matrixBFS)
Issue
The initial element of the provided grid (grid[0][0]) is NaN when executing JavaScript code.
Observed Behavior
Executing the JavaScript code snippet below results in the grid's first element becoming NaN:
class Solution {
/**
* @param {number[][]} grid
* @returns {number}
*/
shortestPath(grid) {
console.log(grid);
}
}Output:
[
[ NaN, 0, 0, 0 ],
[ 1, 1, 0, 0 ],
[ 0, 0, 0, 1 ],
[ 0, 1, 0, 0 ]
]Expected Behavior
The grid provided should contain valid numeric values (0 or 1) without any NaN values.
Steps to Reproduce
- Visit the [Matrix BFS problem page](https://neetcode.io/problems/matrixBFS).
- Paste the JavaScript snippet provided above into the solution editor.
- Execute the code and observe the output.
Environment
- Browser: Chrome Version 134.0.6998.119
- Operating System: MacOS Sequoia 15.3.2 (24D81)
- Platform: JavaScript playground on Neetcode.io