I am doing this question from leetcode where I am getting an error .can somebody help me to find it?I have tried dry running it 2 times sitll i am not able to debug it.

Problem link:

```
class Solution {
public:
int maxProfit(vector<int>& prices) {
long long int n=prices.size();
vector<int> profit(n,0);
vector<int> suffix(n,0);
suffix[n-1]=prices[n-1];
profit[n-1]=0;
for(long long int i=n-2;i>=0;i++)
{
suffix[i]=max(suffix[i+1],prices[i+1]);
profit[i]=suffix[i]-prices[i];
}
int ans =0;
for(long long int i=0;i<n;i++)
ans=max(ans,profit[i]);
return ans;
}
};
```