JenilGajjar20 / JenilGajjar20/Competitive-Programming_problems

Best time to buy and sell stock II

Aperta
#168 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
18
Fork
75
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Problem statement -
You are given an integer array prices where prices[i] is the price of a given stock on the ith day.
On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day.
Find and return the maximum profit you can achieve.

My approach would be using dynamic programming to solve it. I will implement a bottom-up approach that would calculate maximum profit iteratively while handling all edge cases.

I look forward to contributing for solving this problem!

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

The issue names no target file, test, or entry point. Start by locating the repository's existing stock or dynamic-programming solutions and their validation approach. Done means adding a solution for the stated problem that returns the maximum achievable profit for the given price array and handles the described edge cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
devtools
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.