diff --git a/Best Time to Buy and Sell Stock - Leetcode 121/Best Time to Buy and Sell Stock - Leetcode 121.go b/Best Time to Buy and Sell Stock - Leetcode 121/Best Time to Buy and Sell Stock - Leetcode 121.go new file mode 100644 index 0000000..8c2ef11 --- /dev/null +++ b/Best Time to Buy and Sell Stock - Leetcode 121/Best Time to Buy and Sell Stock - Leetcode 121.go @@ -0,0 +1,16 @@ +package solution + +func maxProfit(prices []int) int { + maxProf := 0 + min := prices[0] + for i:=1;i prices[i] { + min = prices[i] + } + } + return maxProf +}