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).
Check if sorted
Remove the air bubbles
Reindex a vector
Unique values without using UNIQUE function
Find Index of maximum Value and maximum Value of a vector
Decimal Fraction to binary conversion
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office