Skip to content

Commit 9d1981e

Browse files
authored
Merge branch 'master' into triangle
2 parents f12f065 + a71618f commit 9d1981e

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ci:
2+
autoupdate_schedule: monthly
3+
14
repos:
25
- repo: https://github.com/pre-commit/pre-commit-hooks
36
rev: v6.0.0
@@ -16,7 +19,7 @@ repos:
1619
- id: auto-walrus
1720

1821
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.13.0
22+
rev: v0.13.2
2023
hooks:
2124
- id: ruff-check
2225
- id: ruff-format
@@ -47,7 +50,7 @@ repos:
4750
- id: validate-pyproject
4851

4952
- repo: https://github.com/pre-commit/mirrors-mypy
50-
rev: v1.18.1
53+
rev: v1.18.2
5154
hooks:
5255
- id: mypy
5356
args:

data_structures/arrays/sudoku_solver.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111
def cross(items_a, items_b):
1212
"""
1313
Cross product of elements in A and elements in B.
14+
15+
>>> cross('AB', '12')
16+
['A1', 'A2', 'B1', 'B2']
17+
>>> cross('ABC', '123')
18+
['A1', 'A2', 'A3', 'B1', 'B2', 'B3', 'C1', 'C2', 'C3']
19+
>>> cross('ABC', '1234')
20+
['A1', 'A2', 'A3', 'A4', 'B1', 'B2', 'B3', 'B4', 'C1', 'C2', 'C3', 'C4']
21+
>>> cross('', '12')
22+
[]
23+
>>> cross('A', '')
24+
[]
25+
>>> cross('', '')
26+
[]
1427
"""
1528
return [a + b for a in items_a for b in items_b]
1629

strings/edit_distance.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ def edit_distance(source: str, target: str) -> int:
1414
1515
>>> edit_distance("GATTIC", "GALTIC")
1616
1
17+
>>> edit_distance("NUM3", "HUM2")
18+
2
19+
>>> edit_distance("cap", "CAP")
20+
3
21+
>>> edit_distance("Cat", "")
22+
3
23+
>>> edit_distance("cat", "cat")
24+
0
25+
>>> edit_distance("", "123456789")
26+
9
27+
>>> edit_distance("Be@uty", "Beautyyyy!")
28+
5
29+
>>> edit_distance("lstring", "lsstring")
30+
1
1731
"""
1832
if len(source) == 0:
1933
return len(target)

0 commit comments

Comments
 (0)