---
title: "Discussion on \"Distance of nearest cell having 1\" | Hashnode"
description: "Discussion on \"Distance of nearest cell having 1\". A medium graph traversal-based dsa question.\nGiven a binary grid of n*m. Find the distance of the nearest 1 in the grid for each cell.The distance is calculated as |i1  - i2| + |j1 - j2|, where i1, j1 are the row number and column number of the curre..."
url: "https://hashnode.com/posts/distance-of-nearest-cell-having-1/640b1d4a9503ca54668ac6a4"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Distance of nearest cell having 1](https://bandeblogs.com/distance-of-nearest-cell-having-1?utm_source=hashnode&utm_medium=feed)

A medium graph traversal-based dsa question. Given a binary grid of n\*m. Find the distance of the nearest 1 in the grid for each cell.The distance is calculated as |i1 - i2| + |j1 - j2|, where i1, j1 are the row number and column number of the curre...

Mar 10, 2023 · 4 min read · bandeblogs.com  
Read the article

-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#dsa](https://hashnode.com/tag/dsa)
-   [#graph](https://hashnode.com/tag/graph)
-   [#bfs](https://hashnode.com/tag/bfs)

## Written by

[bandeji](https://hashnode.com/@theredhandcoder)

@theredhandcoder

  
[View profile](https://hashnode.com/@theredhandcoder)

just not a geek....

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
