Problem 55235. Determine if x is a combination of m and n
- iscombo(17,3,5) should return true because 17 = 4*3 + 1*5
- iscombo(18,3,5) should return true because 18 = 6*3 + 0*5
- iscombo(7,3,5) should return false because 7 cannot be written as a combination of 3 & 5 (7 is not divisible by either 3 or 5 and 1*3 + 1*5 = 8)
Solution Stats
Problem Comments
-
5 Comments
The iscombo function is missing from test 3, which makes you wonder if the assert function is really paying attention.
The test cases have been sorted out individually and the solutions have been rescored.
The last test case still has "assert(a*m+b*n,m,n)" instead of "assert(iscombo(a*m+b*n,m,n))". Also, I found it more convenient to have the first test cases all together, as they were originally, to copy them more easily.
I understand your point Tim, however, individual test cases will help people to find where their code is failing.
I have corrected the last test case and rescored the solutions.
Thanks for catching and fixing that - internet cookies all round!
Solution Comments
Show commentsProblem Recent Solvers170
Suggested Problems
-
Sort a list of complex numbers based on far they are from the origin.
5554 Solvers
-
Sum of first n terms of a harmonic progression
402 Solvers
-
Check if number exists in vector
10728 Solvers
-
13337 Solvers
-
274 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!