Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report for matrixBFS #3964

Open
hsiwkin opened this issue Mar 26, 2025 · 0 comments
Open

Bug Report for matrixBFS #3964

hsiwkin opened this issue Mar 26, 2025 · 0 comments

Comments

@hsiwkin
Copy link

hsiwkin commented Mar 26, 2025

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

  1. Visit the [Matrix BFS problem page](https://neetcode.io/problems/matrixBFS).
  2. Paste the JavaScript snippet provided above into the solution editor.
  3. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant