mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Enable ruff RUF002 rule (#11377)
* Enable ruff RUF002 rule * Fix --------- Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
@ -31,7 +31,7 @@ Explanation: There is no 1 in the matrix.
|
||||
|
||||
Approach:
|
||||
We initialize another matrix (dp) with the same dimensions
|
||||
as the original one initialized with all 0’s.
|
||||
as the original one initialized with all 0's.
|
||||
|
||||
dp_array(i,j) represents the side length of the maximum square whose
|
||||
bottom right corner is the cell with index (i,j) in the original matrix.
|
||||
@ -39,7 +39,7 @@ bottom right corner is the cell with index (i,j) in the original matrix.
|
||||
Starting from index (0,0), for every 1 found in the original matrix,
|
||||
we update the value of the current element as
|
||||
|
||||
dp_array(i,j)=dp_array(dp(i−1,j),dp_array(i−1,j−1),dp_array(i,j−1)) + 1.
|
||||
dp_array(i,j)=dp_array(dp(i-1,j),dp_array(i-1,j-1),dp_array(i,j-1)) + 1.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ def spiral_traversal(matrix: list[list]) -> list[int]:
|
||||
Algorithm:
|
||||
Step 1. first pop the 0 index list. (which is [1,2,3,4] and concatenate the
|
||||
output of [step 2])
|
||||
Step 2. Now perform matrix’s Transpose operation (Change rows to column
|
||||
Step 2. Now perform matrix's Transpose operation (Change rows to column
|
||||
and vice versa) and reverse the resultant matrix.
|
||||
Step 3. Pass the output of [2nd step], to same recursive function till
|
||||
base case hits.
|
||||
|
Reference in New Issue
Block a user