mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
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:
parent
032999f36e
commit
d009cea391
@ -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 the minimum change from the given denominations and value
|
||||||
>>> find_minimum_change([1, 5, 10, 20, 50, 100, 200, 500, 1000,2000], 18745)
|
>>> 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__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
denominations = list()
|
denominations = list()
|
||||||
value = 0
|
value = "0"
|
||||||
|
|
||||||
if (
|
if (
|
||||||
input("Do you want to enter your denominations ? (yY/n): ").strip().lower()
|
input("Do you want to enter your denominations ? (yY/n): ").strip().lower()
|
||||||
|
@ -19,7 +19,7 @@ def make_dataset() -> tuple[list[int], int]:
|
|||||||
dataset = make_dataset()
|
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,
|
Returns a triplet in the array with sum equal to target,
|
||||||
else (0, 0, 0).
|
else (0, 0, 0).
|
||||||
|
@ -31,7 +31,7 @@ def two_sum(nums: list[int], target: int) -> list[int]:
|
|||||||
>>> two_sum([3 * i for i in range(10)], 19)
|
>>> two_sum([3 * i for i in range(10)], 19)
|
||||||
[]
|
[]
|
||||||
"""
|
"""
|
||||||
chk_map = {}
|
chk_map: dict[int, int] = {}
|
||||||
for index, val in enumerate(nums):
|
for index, val in enumerate(nums):
|
||||||
compl = target - val
|
compl = target - val
|
||||||
if compl in chk_map:
|
if compl in chk_map:
|
||||||
|
Loading…
Reference in New Issue
Block a user