Problem Statement | |||||||||||||
Your hobby is collecting postmarks. There is a total of N distinct postmarks, numbered from 0 to N-1. Their prices are given in the int[] prices, where the i-th element (0-indexed) is the price of postmark i. Your goal is to collect as many distinct postmarks as possible. The postmarks you currently have are given in the int[] have. Initially, you have no money. You can sell postmarks to get money to buy different postmarks. Return the maximum number of distinct postmarks you can collect. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | N will be between 1 and 50, inclusive. | ||||||||||||
- | prices will contain exactly N elements. | ||||||||||||
- | Each element of prices will be between 1 and 1,000,000, inclusive. | ||||||||||||
- | have will contain between 0 and N elements, inclusive. | ||||||||||||
- | All elements of have will be distinct. | ||||||||||||
- | Each element of have will be between 0 and N-1, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|