Problem 56030. Pay up

You live in a world where arbitrary denominations of currency exist. You owe your friend a sum of money denoted by s. However, it is possible that neither of you carry exact change for this deal. You and your friend happen to carry currency in only certain specific denominations. You both take all the money you have and lay them out on a table and identify every bill of currency you have collectively. The list L contains the values of each of the bills such that the values corresponding to your bills come with a positive sign and that of your friend negative. The function pay takes as arguments L and s and returns boolean true if the exchange is possible and false otherwise. Complete the definition of pay.
Constraints:
(1) sZ
(2) L ∈ T ∣ T = { { x₁,x₂,...,xₙ } ∣ xᵢ ∈ Z, i ∈ N } ∩ { ∅ }

Solution Stats

45.0% Correct | 55.0% Incorrect
Last Solution submitted on Oct 12, 2022

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers5

Suggested Problems

More from this Author2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!