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