Solution #73 - Jabez/Edited - 17/3/2025#37
Open
ByteSurfer23 wants to merge 2 commits intoDijkstra-Edu:masterfrom
Open
Solution #73 - Jabez/Edited - 17/3/2025#37ByteSurfer23 wants to merge 2 commits intoDijkstra-Edu:masterfrom
ByteSurfer23 wants to merge 2 commits intoDijkstra-Edu:masterfrom
Conversation
JRS296
reviewed
Mar 17, 2025
Comment on lines
+1
to
+29
| What This Code Does: | ||
| * Find zeros in the matrix | ||
|
|
||
| * If a cell is 0, mark its row and column to be zero later. | ||
| * Use the first row & column as markers | ||
|
|
||
| * To track if first row and column have zeros we use firstrow and firstcol boolean variables | ||
|
|
||
| * Instead of creating extra memory, the first row and column store which rows/columns should be zero. | ||
| * Set the marked cells to zero | ||
|
|
||
| * Go through the matrix and make elements 0 based on the markers. | ||
| * Handle the first row and column separately | ||
|
|
||
| If the first row/column originally had a 0, set the entire first row/column to 0. | ||
|
|
||
| Imagine this matrix: | ||
|
|
||
|
|
||
| 1 2 3 | ||
| 4 0 6 | ||
| 7 8 9 | ||
|
|
||
| After running the code, it becomes: | ||
|
|
||
| 1 0 3 | ||
| 0 0 0 | ||
| 7 0 9 | ||
| The 0 at (1,1) caused its entire row and column to be zero. No newline at end of file |
Member
There was a problem hiding this comment.
This doesn't seem too clear. Could you try doing something like this? https://github.com/Dijkstra-Edu/LeetCode-Solutions/pull/16/files
Member
There was a problem hiding this comment.
Also use the template File for your explanation: https://github.com/Dijkstra-Edu/LeetCode-Solutions/blob/master/Explanation-Template.md
JRS296
requested changes
Mar 17, 2025
Member
JRS296
left a comment
There was a problem hiding this comment.
Kindly utilize Markdown capabilities for the explanation file, and try to do it using this as a template.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solution and explanation added