From faf8a22cc302a4ab6bfdd48fef5f96067297035e Mon Sep 17 00:00:00 2001 From: piyush6348 Date: Sat, 3 Oct 2020 21:38:47 +0530 Subject: [PATCH] added Buy & Sell stock 2 --- Arrays/Buy And Sell Stocks 2.cpp | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Arrays/Buy And Sell Stocks 2.cpp diff --git a/Arrays/Buy And Sell Stocks 2.cpp b/Arrays/Buy And Sell Stocks 2.cpp new file mode 100644 index 0000000..a897897 --- /dev/null +++ b/Arrays/Buy And Sell Stocks 2.cpp @@ -0,0 +1,6 @@ +int maxProfit(vector& prices) { + int ans = 0; + for(int i = 1; i