Skip to content

Commit 723d246

Browse files
authored
Update Solution.c
1 parent eebb5f3 commit 723d246

File tree

1 file changed

+3
-3
lines changed
  • Algorithms/Easy/121_BestTimeToBuyAndSellStock

1 file changed

+3
-3
lines changed

Algorithms/Easy/121_BestTimeToBuyAndSellStock/Solution.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ int maxProfit(int* prices, int pricesSize){
22
int answer = 0;
33
int buyingPrice = prices[0];
44

5-
for(int i = 1; i < pricesSize; i++){
6-
if(prices[i] < buyingPrice)
5+
for (int i = 1; i < pricesSize; i++){
6+
if (prices[i] < buyingPrice)
77
buyingPrice = prices[i];
88
else if (prices[i] - buyingPrice > answer)
99
answer = prices[i] - buyingPrice;
1010
}
1111

1212
return answer;
13-
}
13+
}

0 commit comments

Comments
 (0)