From 91ce7aaa9f179a8383d7bb6d227d97240faa917d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 25 Sep 2023 16:01:44 +0530 Subject: [PATCH] #254 --- .../CppSolutionBestTimetoBuyandSellStock.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Best Time to Buy and Sell Stocks/CppSolutionBestTimetoBuyandSellStock.cpp diff --git a/Best Time to Buy and Sell Stocks/CppSolutionBestTimetoBuyandSellStock.cpp b/Best Time to Buy and Sell Stocks/CppSolutionBestTimetoBuyandSellStock.cpp new file mode 100644 index 0000000..6e2cff2 --- /dev/null +++ b/Best Time to Buy and Sell Stocks/CppSolutionBestTimetoBuyandSellStock.cpp @@ -0,0 +1,13 @@ +class Solution { +public: + + int maxProfit(vector& v) { + int n = v.size(); + int curr=0,mx=0; + for(int i=0;imx) mx = curr; + } return mx; + } +}; \ No newline at end of file