Don't be Greedy! - MATLAB Cody - MATLAB Central

Problem 45416. Don't be Greedy!

Difficulty:Rate

A list of assignments is given to the students along with the submission deadlines. Each of the assignment contains particular marks.

If the student can submit a particular assignment within its deadline, he'll get marks.

But he can submit only one assignment per day.

For instance,

 Assignment = [ a1, a2, a3, a4, a5, a6]
 Marks      = [ 60,100, 20, 40, 20, 10]
 Deadline   = [  2,  1,  3,  2,  1,  3]

Now, on the 1st day - he can submit one among all the assignments. But in the 2nd day, he can no longer submit a2 & a5.

He wants to achieve maximum marks by carefully submitting those assignments within the deadlines. Can u help him?

The answer should be - [a2,a1,a3]. Since by submitting in this sequence, he can get the maximum marks.

Solution Stats

11.36% Correct | 88.64% Incorrect
Last Solution submitted on Apr 03, 2025

Problem Comments

Solution Comments

Show comments
Registration Now Open for MathWorks AUTOMOTIVE CONFERENCE 2025
...
Hello Community, We're excited to announce that registration is now open for the...

Problem Recent Solvers9

Suggested Problems

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!
Go to top of page