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
This commit is contained in:
imp 2021-08-16 03:15:53 +08:00 committed by GitHub
parent 032999f36e
commit d009cea391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ Following is minimal change for 456 :
"""
def find_minimum_change(denominations: list[int], value: int) -> list[int]:
def find_minimum_change(denominations: list[int], value: str) -> list[int]:
"""
Find the minimum change from the given denominations and value
>>> 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]:
if __name__ == "__main__":
denominations = list()
value = 0
value = "0"
if (
input("Do you want to enter your denominations ? (yY/n): ").strip().lower()

View File

@ -19,7 +19,7 @@ def make_dataset() -> tuple[list[int], int]:
dataset = make_dataset()
def triplet_sum1(arr: list[int], target: int) -> tuple[int, int, int]:
def triplet_sum1(arr: list[int], target: int) -> tuple[int, ...]:
"""
Returns a triplet in the array with sum equal to target,
else (0, 0, 0).

View File

@ -31,7 +31,7 @@ def two_sum(nums: list[int], target: int) -> list[int]:
>>> two_sum([3 * i for i in range(10)], 19)
[]
"""
chk_map = {}
chk_map: dict[int, int] = {}
for index, val in enumerate(nums):
compl = target - val
if compl in chk_map: