Lakhankumawat / LearnCPP

Learn Cpp from Beginner to Advanced ✅ Practice 🎯 Code 💻 Repeat 🔁 One step solution for c++ beginners and cp enthusiasts.
https://lakhankumawat.github.io/LearnCPP/
MIT License
598 stars 484 forks source link

Buy Maximum Stocks if i stocks can be bought on i-th day #1541

Closed 072arushi closed 2 years ago

072arushi commented 2 years ago

Description

In a stock market, there is a product with infinite stocks. The stock prices are given for N days, where arr[i] denotes the price of the stock on an ith day. There is a rule that a customer can buy at most I stock on an ith day. If the customer has an amount of k amount of money initially, find out the maximum number of stocks a customer can buy. For example, for 3 days the price of a stock is given as 7, 10, 4. You can buy 1 stock worth 7 rs on day 1, 2 stocks worth 10 rs each on day 2, and 3 stocks worth 4 rs each on day 3.

Examples: Input : price[] = { 10, 7, 19 }, k = 45. Output : 4

Domain

CPP

Type of Contribution

Addition

Code of Conduct

072arushi commented 2 years ago

/assign

github-actions[bot] commented 2 years ago

Hello @072arushi, thanks for creating your first issue at LearnCPP, hope you followed the guidelines.

github-actions[bot] commented 2 years ago

This issue has been assigned to 072arushi! It will become unassigned if it is not closed within 12 days. A maintainer can also add the pinned label to prevent it from being unassigned.