From 435cb4936f41892d995b23ab81f8cfb33639c4eb Mon Sep 17 00:00:00 2001 From: Naresh <58628794+ortin779@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:46:26 +0530 Subject: [PATCH] Create Best Time to Buy and Sell Stock - Leetcode 121.go golang solution to Best time to buy and sell stock --- ... Time to Buy and Sell Stock - Leetcode 121.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Best Time to Buy and Sell Stock - Leetcode 121/Best Time to Buy and Sell Stock - Leetcode 121.go 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 +}