Problem 55235. Determine if x is a combination of m and n
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
-
2 Comments
There is a problem with the tests. Particularly with Test 20.
My solution kept failing the test until I changed the output to "False" always. At that point the solution passed.
Any feedback / suggestions would be appreciated.
@Lev: the line "combo=combo+1;" means that in some cases, the output can be > 1. All the other test cases just force-converted to logical so any nonzero numeric return will be T and 0 will be F. Test 20, however, actually checks against another logical, so the numerical return (>1) fails. The problem states that the function should return logical T/F, so there should probably be a test specifically for that.
Problem Recent Solvers122
Suggested Problems
-
15105 Solvers
-
16599 Solvers
-
Back to basics 6 - Column Vector
1013 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
846 Solvers
-
351 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!