Find Max Distinct Items

From Ibm interviews, this coding interview problem asks: given n items where item i costs i dollars, an array arr of m items already bought, and a budget k, determine the maximum total number of distinct items you can own after additional purchases. Return the count. A concise interview question for a coding interview that focuses on budgets, distinct items, and constraints.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: