Skip to content

Commit da5abf6

Browse files
refactor 638
1 parent bb95fd3 commit da5abf6

File tree

1 file changed

+0
-37
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-37
lines changed

src/main/java/com/fishercoder/solutions/_638.java

-37
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,6 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
/**
7-
* 638. Shopping Offers
8-
*
9-
* In LeetCode Store, there are some kinds of items to sell. Each item has a price.
10-
* However, there are some special offers, and a special offer consists of one or more different kinds of items with a sale price.
11-
* You are given the each item's price, a set of special offers,
12-
* and the number we need to buy for each item.
13-
* The job is to output the lowest price you have to pay for exactly certain items as given,
14-
* where you could make optimal use of the special offers.
15-
* Each special offer is represented in the form of an array,
16-
* the last number represents the price you need to pay for this special offer,
17-
* other numbers represents how many specific items you could get if you buy this offer.
18-
* You could use any of special offers as many times as you want.
19-
20-
Example 1:
21-
Input: [2,5], [[3,0,5],[1,2,10]], [3,2]
22-
Output: 14
23-
Explanation:
24-
There are two kinds of items, A and B. Their prices are $2 and $5 respectively.
25-
In special offer 1, you can pay $5 for 3A and 0B
26-
In special offer 2, you can pay $10 for 1A and 2B.
27-
You need to buy 3A and 2B, so you may pay $10 for 1A and 2B (special offer #2), and $4 for 2A.
28-
29-
Example 2:
30-
Input: [2,3,4], [[1,1,0,4],[2,2,1,9]], [1,2,1]
31-
Output: 11
32-
Explanation:
33-
The price of A is $2, and $3 for B, $4 for C.
34-
You may pay $4 for 1A and 1B, and $9 for 2A ,2B and 1C.
35-
You need to buy 1A ,2B and 1C, so you may pay $4 for 1A and 1B (special offer #1), and $3 for 1B, $4 for 1C.
36-
You cannot add more items, though only $9 for 2A ,2B and 1C.
37-
38-
Note:
39-
There are at most 6 kinds of items, 100 special offers.
40-
For each item, you need to buy at most 6 of them.
41-
You are not allowed to buy more items than you want, even if that would lower the overall price.
42-
*/
436
public class _638 {
447
public static class Solution1 {
458
/**

0 commit comments

Comments
 (0)