# Need help with computer science to Find the pseudo-code to optimize this problem.

**Question description**

Problem 1. (Package Delivery) Tom is working for a delivery company. Every morning, Tom is given a list of *n* packages to choose those that he wants to deliver within *L* hours. Each package has a specified arrival time (when it is available to be delivered) and a specified delivery reward. The company requires that one person cannot choose two packages whose arrival times are less than or equal to 3 hours apart.

The problem is to find a subset of packages so as to maximize the total delivery reward, subjecting to this restriction.

Example. Suppose *L* = 10, *n* = 4, arrival time list (sorted in increasing order as {t1, t2, t3, t4} = {3, 5, 7, 9}, and delivery reward list as{r1, r2, r3, r4} = {6, 8, 7, 4}, then the optimal solution would be to choose package 1 and 3, for total reward of 13.

## Tutor Answer

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors