Skip to content

Commit 16ff978

Browse files
pa-kh039cclauss
andauthored
improving code for better readability
Co-authored-by: Christian Clauss <[email protected]>
1 parent e78e5f6 commit 16ff978

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dynamic_programming/largest_divisible_subset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def largest_divisible_subset(array: list[int]) -> list[int]:
3838
hash_array = list(range(array_size))
3939

4040
# Iterate through the array
41-
for i in range(array_size):
41+
for i, item in enumerate(array):
4242
for prev_index in range(i):
43-
if array[i] % array[prev_index] == 0 and 1 + memo[prev_index] > memo[i]:
43+
if item % array[prev_index] == 0 and 1 + memo[prev_index] > memo[i]:
4444
memo[i] = 1 + memo[prev_index]
4545
hash_array[i] = prev_index
4646

0 commit comments

Comments
 (0)