Skip to content

Commit 48b8618

Browse files
Update algorithms/dynamic_programming/maximal_rectangle/README.md
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent cf79f0c commit 48b8618

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • algorithms/dynamic_programming/maximal_rectangle

algorithms/dynamic_programming/maximal_rectangle/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ arrays (height, left, right) to efficiently compute the maximal rectangle’s ar
6666
- **Second pass (right to left)**: We iterate backward to update the right boundaries and calculate the area.
6767
- If `matrix[i][j]` is ‘1’:
6868
- The new `right[j]` is the minimum of its existing value and `current_right`.
69-
- Otherwise, the `matrix[i][j]` is ‘0’:
70-
- `right[j]` is reset to ~, and `current_right` is updated to `j`.
69+
- Otherwise, the `matrix[i][j]` is '0':
70+
- `right[j]` is reset to `n`, and `current_right` is updated to `j`.
7171
- With `height`, `left`, and `right` updated for position `j`, we can calculate the area of the rectangle with
7272
height `height[j]` and width `right[j] - left[j]`. We update maxArea with the maximum area found so far.
7373
- After iterating through all rows, `max_area` holds the result, which we return.

0 commit comments

Comments
 (0)