Problem 42386. Faint Receipt
there may be a few incorrect tests here (e.g. test 2 with 'X31.6X' and qty=111 should return '531.69' if I am interpreting correctly)
agree with alfonso
I had the same issue with that particular test case.
I've updated the test suite. It should work now. I selected the option to have all previous solutions rescored, but I've never actually seen that option work for other problems I've worked on, so just submit your solutions again. Also, refer to comments on http://www.mathworks.com/matlabcentral/cody/problems/42385-combined-ages-4-non-symmetric-with-multiples-n-3 regarding not being able to use the "Test reference solution" button currently. Is anyone else having that problem?
I believe rescoring doesn't work immediately, but all solutions seem to be rescored now. "Test reference solution" doesn't work for me neither. As far as I remember it's not the first time it doesn't work (on my account), but previous incidents had shorter duration (week or so).
That link doesn't work as written (at least, it didn't for me). It does function, though, if you truncate the url at #.
Could I convince you to not use isequal() when comparing floating point numbers in the test suite?
Funny behavior of possible over-reactive spam filter in Cody: changing this code to use instead of char(str2num('[49 36 49.... 36 50 57')) the actual char array '1$1...$29' will get you an "inappropriate content" flag... I admit no regexprep string should ever have that many dollar signs...
fails for partial_amt = 'X67.9X'; qty = 9; and many, many others
A bunch of your solutions now pass the test suite, so perhaps this comment is outdated?
In above case it returns 567.90, correct answer would be 167.94. This solution is minimizing last digit which works in most cases, but is based on wrong assumptions. It passes test, but doesn't solve the problem. Yes, my later submissions doesn't have this bug, but I'm unsatisfied when those wrong ones are going through the test alive :-)
You had me confused, since that specific combination isn't in the test suite, but I think I understand now. In your quest for perfection, you've been testing the solution against more test cases. That's the really difficult thing about making these problems—coming up with a robust test suite that's in-depth enough to only let completely correct solutions through.
Sorry Grant. Yes, I'm used to do more tests and I was suspicious about my algorithm.
Problem Recent Solvers16
Find common elements in matrix rows
More from this Author139
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!