Get Wrong Answer when judge one of test cases BUT it is the same as expected output on my LOCAL ENV.

The test case can like as follow:

- Input: [1,2]
- Output: 0
- Expected: 1

Then Please refer my source code:

```
class Solution{
public:
int maxProfit(vector<int> &prices){
int psize=prices.size();
if(psize<2)
return 0;
vector<int> l(psize);
vector<int> r(psize);
/*solve by DP*/
l[0]=0;
r[psize-1]=0;
int lminv=prices[0];
int rmaxv=prices[psize-1];
for(int j=1;j<psize;++j){
//subfunction get best profit by once
// [front,tail]
//left part solution
if(prices[j]<lminv){
lminv=prices[j];
l[j]=l[j-1];
}
else{
int tprt=prices[j]-lminv;
if(tprt<=l[j-1])
l[j]=l[j-1];
else
l[j]=tprt;
}
//right part solution
int rfront=psize-1-j;
if(prices[rfront]>rmaxv){
rmaxv=prices[rfront];
r[rfront]=r[rfront+1];
}
else{
int tprt=rmaxv-prices[rfront];
if(tprt<=r[rfront])
r[rfront]=r[rfront+1];
else
r[rfront]=tprt;
}
}
int bstprt=0;
for(int i=0;i<psize;++i){
bstprt=max(bstprt,l[i]+r[i+1]);
}
return bstprt;
}
};
```

Thank you for your review !