Question DSA-GRDY-0068
HardJobs have deadlines and profits, each taking one unit of time. Which greedy approach maximises profit?
- A.
Sort by deadline only
- B.
Sort by shortest job
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Greedy question
Jobs have deadlines and profits, each taking one unit of time. Which greedy approach maximises profit?
Sort by deadline only
Sort by shortest job
Sign up free to see the answer and a step-by-step explanation.
Take jobs in input order
Sort by profit (highest first) and place each job in the latest free slot before its deadline