How is this a dp question?


It should be under simple arrays

int ans = 0 ;
    int m =  INT_MAX;
    for(auto i:A){
        ans = max(ans,i-m);
        m = min(i,m);
    return ans;


This question should not be in dp.
Its a array question. Even for arrays its a very simple question.


solution using DP
int Solution::maxProfit(const vector &A) {
int n=A.size();
int T10=0;
int T11=INT_MIN;
for(int i=0;i<n;i++){
int T11_old=T11;
return T10;