* updating DIRECTORY.md

* Fix ruff

* Fix

* Fix

* Fix

* Revert "Fix"

This reverts commit 5bc3bf342208dd707da02dea7173c059317b6bc6.

* 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:
Maxim Smolskiy
2024-08-25 18:33:11 +03:00
committed by GitHub
parent 48418280b1
commit e3fa014a5a
13 changed files with 22 additions and 36 deletions

View File

@ -75,8 +75,7 @@ def solution(n: str = N) -> int:
product = 1
for j in range(13):
product *= int(n[i + j])
if product > largest_product:
largest_product = product
largest_product = max(largest_product, product)
return largest_product

View File

@ -39,8 +39,7 @@ def solution(n: int = 1000) -> int:
c = n - a - b
if c * c == (a * a + b * b):
candidate = a * b * c
if candidate >= product:
product = candidate
product = max(product, candidate)
return product

View File

@ -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

View File

@ -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