Question: def can_pay_with_two_coins(denoms: List[int], amount: int) -> bool: Return True if and only if it is possible to form amount, which is a number of cents,

def can_pay_with_two_coins(denoms: List[int], amount: int) -> bool:

"""Return True if and only if it is possible to form amount, which is a number of cents, using exactly two coins, which can be of any of the denominatins in denoms.

You can repeat coins (e.g., use two 10 cent coins to make 20).

>>> can_pay_with_two_coins([1, 5, 10, 25], 35)

True

>>> can_pay_with_two_coins([1, 5, 10, 25], 20)

True

"""

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!