Problem 45416. Don't be Greedy!
Solution Stats
Problem Comments
-
8 Comments
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?
ok..i see..
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).
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
-
Project Euler: Problem 1, Multiples of 3 and 5
2765 Solvers
-
Sum of diagonal of a square matrix
1517 Solvers
-
Make an awesome ramp for a tiny motorcycle stuntman
600 Solvers
-
159 Solvers
-
318 Solvers
More from this Author165
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!