mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Fix ruff (#11527)
* updating DIRECTORY.md
* Fix ruff
* Fix
* Fix
* Fix
* Revert "Fix"
This reverts commit 5bc3bf3422.
* find_max.py: noqa: PLR1730
---------
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
@@ -63,8 +63,7 @@ def largest_product(grid):
|
||||
max_product = max(
|
||||
vert_product, horz_product, lr_diag_product, rl_diag_product
|
||||
)
|
||||
if max_product > largest:
|
||||
largest = max_product
|
||||
largest = max(largest, max_product)
|
||||
|
||||
return largest
|
||||
|
||||
|
||||
@@ -45,15 +45,13 @@ def solution():
|
||||
for i in range(20):
|
||||
for j in range(17):
|
||||
temp = grid[i][j] * grid[i][j + 1] * grid[i][j + 2] * grid[i][j + 3]
|
||||
if temp > maximum:
|
||||
maximum = temp
|
||||
maximum = max(maximum, temp)
|
||||
|
||||
# down
|
||||
for i in range(17):
|
||||
for j in range(20):
|
||||
temp = grid[i][j] * grid[i + 1][j] * grid[i + 2][j] * grid[i + 3][j]
|
||||
if temp > maximum:
|
||||
maximum = temp
|
||||
maximum = max(maximum, temp)
|
||||
|
||||
# diagonal 1
|
||||
for i in range(17):
|
||||
@@ -64,8 +62,7 @@ def solution():
|
||||
* grid[i + 2][j + 2]
|
||||
* grid[i + 3][j + 3]
|
||||
)
|
||||
if temp > maximum:
|
||||
maximum = temp
|
||||
maximum = max(maximum, temp)
|
||||
|
||||
# diagonal 2
|
||||
for i in range(17):
|
||||
@@ -76,8 +73,7 @@ def solution():
|
||||
* grid[i + 2][j - 2]
|
||||
* grid[i + 3][j - 3]
|
||||
)
|
||||
if temp > maximum:
|
||||
maximum = temp
|
||||
maximum = max(maximum, temp)
|
||||
return maximum
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user