Question bank › Dynamic Programming
Dsa Dynamic Programming Easy

Inventory Management

A store is managing its inventory across several categories. Each category has a given quantity of items and a maximum number of categories that can be stocked in order to maximize sales. You need to calculate the maximum number of items you can stock while adhering to the maximum category limit. Input format: The first line contains two integers n (1 <= n <= 100) - number of categories, and k - maximum categories allowed to stock. The second line contains n integers representing the quantities of items in each category. Output format: Print the maximum number of items you can stock. Example: Input: 3 2 10 20 30 Output: 30

Key concepts

dynamic_programminginventorycounting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.