From e41000ac79b46bae3c1f76baf4ddaed95ef3757c Mon Sep 17 00:00:00 2001 From: yash7047 Date: Mon, 5 Oct 2020 09:33:36 +0530 Subject: [PATCH] maximum_circular_subarray_sum --- maximum_circular_sum.txt | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 maximum_circular_sum.txt diff --git a/maximum_circular_sum.txt b/maximum_circular_sum.txt new file mode 100644 index 0000000..4cbe9eb --- /dev/null +++ b/maximum_circular_sum.txt @@ -0,0 +1,57 @@ +/* MY COMPETITIVE CODING TEMPLATE */ +#include +using namespace std; +#define ll long long int +#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL); +#define pb push_back +#define pp pair +#define all(v) (v).begin(),(v).end() +#define sz(v) (ll)(v).size() +#define F first +#define S second +#define lc "\n" +ll MAX=1e18 , MIN=-1e18 , MOD=1000000007; +void YJ() +{ +#ifndef ONLINE_JUDGE + freopen("input.txt","r",stdin); + freopen("output.txt","w",stdout); +#endif +} + +/* CODE STARTS HERE */ + +/* KADANE'S ALGORITHM */ +int kadane(int arr[],int n) +{ + int max_so_far=0,sum=0; + for(int i=0;i>n; int arr[n]; + for(i=0;i>arr[i]; + cout<<"Maximum circular sum is "<