mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 18:49:26 +08:00
Add flake8-builtins to pre-commit and fix errors (#7105)
Ignore `A003` Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
This commit is contained in:
@ -17,12 +17,12 @@ def next_greatest_element_slow(arr: list[float]) -> list[float]:
|
||||
arr_size = len(arr)
|
||||
|
||||
for i in range(arr_size):
|
||||
next: float = -1
|
||||
next_element: float = -1
|
||||
for j in range(i + 1, arr_size):
|
||||
if arr[i] < arr[j]:
|
||||
next = arr[j]
|
||||
next_element = arr[j]
|
||||
break
|
||||
result.append(next)
|
||||
result.append(next_element)
|
||||
return result
|
||||
|
||||
|
||||
@ -36,12 +36,12 @@ def next_greatest_element_fast(arr: list[float]) -> list[float]:
|
||||
"""
|
||||
result = []
|
||||
for i, outer in enumerate(arr):
|
||||
next: float = -1
|
||||
next_item: float = -1
|
||||
for inner in arr[i + 1 :]:
|
||||
if outer < inner:
|
||||
next = inner
|
||||
next_item = inner
|
||||
break
|
||||
result.append(next)
|
||||
result.append(next_item)
|
||||
return result
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user