You are playing a factory simulator. The rules are pretty easy. Initially, at time 0, your factory's productivity is equal to 1. During each second, you can either increase productivity by one or produce productivity units of goods.
You will be given a String[] orders, each element of which represents a single order you can potentially fill. Each element is formatted as "time goods income" (quotes for clarity).
If you have at least goods units of goods at exactly time seconds, you can exchange those goods for income dollars. You must fulfill the order exactly at its given time - it is no longer valid after that time.
Each order can be satisfied only once. Several orders may have the same time. Return the maximum number of dollars you can earn.
|