Skip to content

Commit d009cea

Browse files
authored
Fix mypy error at maths (#4613)
* Fix mypy errors for maths/greedy_coin_change.py * Fix mypy errors for maths/two_sum.py * Fix mypy errors for maths/triplet_sum.py * Fix the format of maths/greedy_coin_change.py * Fix the format of maths/greedy_coin_change.py * Fix format with pre-commit
1 parent 032999f commit d009cea

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Diff for: maths/greedy_coin_change.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"""
4242

4343

44-
def find_minimum_change(denominations: list[int], value: int) -> list[int]:
44+
def find_minimum_change(denominations: list[int], value: str) -> list[int]:
4545
"""
4646
Find the minimum change from the given denominations and value
4747
>>> find_minimum_change([1, 5, 10, 20, 50, 100, 200, 500, 1000,2000], 18745)
@@ -75,7 +75,7 @@ def find_minimum_change(denominations: list[int], value: int) -> list[int]:
7575
if __name__ == "__main__":
7676

7777
denominations = list()
78-
value = 0
78+
value = "0"
7979

8080
if (
8181
input("Do you want to enter your denominations ? (yY/n): ").strip().lower()

Diff for: maths/triplet_sum.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def make_dataset() -> tuple[list[int], int]:
1919
dataset = make_dataset()
2020

2121

22-
def triplet_sum1(arr: list[int], target: int) -> tuple[int, int, int]:
22+
def triplet_sum1(arr: list[int], target: int) -> tuple[int, ...]:
2323
"""
2424
Returns a triplet in the array with sum equal to target,
2525
else (0, 0, 0).

Diff for: maths/two_sum.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def two_sum(nums: list[int], target: int) -> list[int]:
3131
>>> two_sum([3 * i for i in range(10)], 19)
3232
[]
3333
"""
34-
chk_map = {}
34+
chk_map: dict[int, int] = {}
3535
for index, val in enumerate(nums):
3636
compl = target - val
3737
if compl in chk_map:

0 commit comments

Comments
 (0)