From ef72ae08d6668c3a07875266af0df4082e1aef43 Mon Sep 17 00:00:00 2001 From: Akshat kumar Date: Fri, 1 Oct 2021 11:31:39 +0530 Subject: [PATCH] Stocks Buy and sell problem Array - Cpp In this problem, highest profit is calculated from the given array of stocks prise --- .../stocks_Buy_And_Sell_Problem.cpp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Algorithms/Algorithms/stocks_Buy_And_Sell_Problem.cpp diff --git a/Algorithms/Algorithms/stocks_Buy_And_Sell_Problem.cpp b/Algorithms/Algorithms/stocks_Buy_And_Sell_Problem.cpp new file mode 100644 index 0000000..54b228c --- /dev/null +++ b/Algorithms/Algorithms/stocks_Buy_And_Sell_Problem.cpp @@ -0,0 +1,26 @@ +#include + +using namespace std; + +int stocksProfit(int arr[],int n){ + int minPrice= INT_MAX; + int maxProfit = 0; + for(int i=0 ; i>n; + int arr[n]; + for(int i =0 ; i>arr[i]; + } + cout<<"Maximum Profit: "<