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
Solution Comments
Show comments
Loading...
Problem Recent Solvers5
Suggested Problems
-
822 Solvers
-
Find the next Fibonacci number
901 Solvers
-
Convert from Fahrenheit to Celsius
27621 Solvers
-
50 Solvers
-
Check if a matrix Diagonal is equal to its secondary diagonal
37 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!
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.
The test cases should've been strong since the beginning
Your solution should've been strong since the beginning :)