Problem 45416. Don't be Greedy!
I think the solution is not unique.
can u tell me where/which test suite u're facing problem?
cz I think the solution should be unique since there is only one parameter.
In the test2. Why [7 3 4 5 6] is not right?
if there are more than one possibilities..they should be placed in sorted manner. that should do it
sorted?[3 4] or [4 3] in test2?
sorted based on the marks --
[40,50] == [4,3]
found it difficult but fun :)
The problem is not difficult, but the test suite should accept all possible solutions since there is not an unique order, for instance at test cases #2 and #4. Sorting values increases this problem's difficulty since there may be several works with the same (or complementary) weight that can be done to achieve the same score (a proper description should be added to the problem since there may cases which are not trivial to sort).
PS: In this problem when any two works have the same deadline, but their marks differ, the lowest mark should come first (which seems weird). And no explanation is given for two works that have the same deadline and mark (but at least there isn't a case at the test suite).
Problem Recent Solvers6
Find the alphabetic word product
More from this Author165
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!