text: Function for dfs . i , j == > Current cell indexes vis == > To mark visited cells ans == > Result z == > Current count 0 s visited z_count == > Total 0 s present
code: function dfs ( i , j , grid , vis , z , z_count ) { let n = grid . length , m = grid [ 0 ] . length ;