Skip to content

Commit 342669a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 69a579b commit 342669a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

dynamic_programming/beautiful_arrangement.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
"""
1111
# Solution using Backtracking
1212

13+
1314
class beautifularrange:
1415
# funtion call; n is the size of the permutation (numbers 1..n)
1516
def countarrangement(self, n: int) -> int:
16-
1717
self.count = 0
1818
"""
19-
We initialize a counter to record how many valid arrangements we find.
19+
We initialize a counter to record how many valid arrangements we find.
2020
Using self.count lets the nested function modify it without nonlocal.
2121
"""
22-
22+
2323
used = [False] * (n + 1)
2424
"""
25-
A boolean list to mark which numbers have
25+
A boolean list to mark which numbers have
2626
already been placed in the permutation.
2727
"""
2828

@@ -33,7 +33,7 @@ def backtrack(pos):
3333
We try to assign a number to position pos.
3434
"""
3535
if pos > n:
36-
self.count += 1
36+
self.count += 1
3737
# We found a complete valid arrangement, so increment the total count.
3838
return
3939
for num in range(

0 commit comments

Comments
 (0)