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) s ∈ Z
(2) L ∈ T ∣ T = { { x₁,x₂,...,xₙ } ∣ xᵢ ∈ Z, i ∈ N } ∩ { ∅ }
Solution Stats
Problem Comments
-
3 Comments
Sourabh Warrier
on 29 Sep 2022
The tests cases for this problem will be refreshed occasionally. This is to protect the integrity of legitimate solvers. Only solutions that actually address the problem will be remain unaffected. Bypassing the problem by brute forcing the test suite will be flagged as a hack.
Ramy Salem
on 4 Oct 2022
The test cases should've been strong since the beginning
Sourabh Warrier
on 13 Oct 2022
Your solution should've been strong since the beginning :)
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
14446 Solvers
-
181 Solvers
-
371 Solvers
-
669 Solvers
-
Predicting life and death of a memory-less light bulb
326 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!