int maxProfit(int* prices, int pricesSize){
if(pricesSize==0)
{
return 0;
}
int price=0;
for(int i=0;i<pricesSize;i++)
{
for(int j=i+1;j<pricesSize;j++)
{
if(price<prices[j]-prices[i])
{
price=prices[j]-prices[i];
}
}
}
return price;
}
LeetCode:121.买卖股票的最佳时机
猜你喜欢
转载自blog.csdn.net/dosdiosas_/article/details/105713702
今日推荐
周排行