From b884e0526946b36da7df41d766ff2657ff001cd2 Mon Sep 17 00:00:00 2001 From: Rabi Kumar singh Date: Thu, 26 Aug 2021 09:30:09 +0530 Subject: [PATCH] Create 121 --- 100-200q/121 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 100-200q/121 diff --git a/100-200q/121 b/100-200q/121 new file mode 100644 index 0000000..c832b51 --- /dev/null +++ b/100-200q/121 @@ -0,0 +1,12 @@ +Best Time to Buy and Sell Stock +class Solution: + def maxProfit(self, prices: List[int]) -> int: + max_profit=0 + buy=float('Inf') + + for i in price: + if i max_profit: + max_profit=i-buy + print(max_profit)