Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Jan 4, 2024
1 parent ce82fed commit 09a4e89
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions array.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ def list_compare1(A,B):
Comment:
Still faster than: return all(A[n] == B[n] for n in range(0, len(A)))
"""
for n in range(0,len(A)):
if A[n] != B[n]:
return False
return True
return all(A[n] == B[n] for n in range(0, len(A)))


def list_compare2(A,B):
Expand All @@ -28,8 +25,7 @@ def list_compare2(A,B):

def fixed_sliding_window(arr, k):
result = [sum(arr[:k])]
for i in range(0, len(arr)-k):
result.append(result[i] + arr[i+k] - arr[i])
result.extend(result[i] + arr[i+k] - arr[i] for i in range(0, len(arr)-k))
return result
print(fixed_sliding_window(list(range(1,7)),3))

Expand Down

0 comments on commit 09a4e89

Please sign in to comment.