14
14
Output:
15
15
2
16
16
17
- Explaination : The maximum size of the square
17
+ Explanation : The maximum size of the square
18
18
sub-matrix is 2. The matrix itself is the
19
19
maximum sized sub-matrix in this case.
20
20
---
26
26
[0, 0]]
27
27
Output: 0
28
28
29
- Explaination : There is no 1 in the matrix.
29
+ Explanation : There is no 1 in the matrix.
30
30
31
31
32
- Approch :
32
+ Approach :
33
33
We initialize another matrix (dp) with the same dimensions
34
34
as the original one initialized with all 0’s.
35
35
@@ -50,7 +50,7 @@ def largest_square_area_in_matrix_top_down_approch(
50
50
Function updates the largest_square_area[0], if recursive call found
51
51
square with maximum area.
52
52
53
- We arent using dp_array here, so the time complexity would be exponential.
53
+ We aren't using dp_array here, so the time complexity would be exponential.
54
54
55
55
>>> largest_square_area_in_matrix_top_down_approch(2, 2, [[1,1], [1,1]])
56
56
2
@@ -126,7 +126,7 @@ def largest_square_area_in_matrix_bottom_up(
126
126
rows : int , cols : int , mat : list [list [int ]]
127
127
) -> int :
128
128
"""
129
- Function updates the largest_square_area, using bottom up approch .
129
+ Function updates the largest_square_area, using bottom up approach .
130
130
131
131
>>> largest_square_area_in_matrix_bottom_up(2, 2, [[1,1], [1,1]])
132
132
2
@@ -156,7 +156,8 @@ def largest_square_area_in_matrix_bottom_up_space_optimization(
156
156
rows : int , cols : int , mat : list [list [int ]]
157
157
) -> int :
158
158
"""
159
- Function updates the largest_square_area, using bottom up approch. with space optimization.
159
+ Function updates the largest_square_area, using bottom up
160
+ approach. with space optimization.
160
161
161
162
>>> largest_square_area_in_matrix_bottom_up_space_optimization(2, 2, [[1,1], [1,1]])
162
163
2
0 commit comments