diff --git a/honorary-one-line-wonders/cplusplus/yashagarwal1999_Largest _sum_of_consecutive_numbers_in_an_array.cpp b/honorary-one-line-wonders/cplusplus/yashagarwal1999_Largest _sum_of_consecutive_numbers_in_an_array.cpp new file mode 100644 index 00000000..5c4b9674 --- /dev/null +++ b/honorary-one-line-wonders/cplusplus/yashagarwal1999_Largest _sum_of_consecutive_numbers_in_an_array.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +typedef long long int ll; +pair maxsum(ll arr[],ll n) +{ +ll sum=0; +ll max=0; +pairp; +ll x=0,y=0; +for(ll i=0;imax){max=sum;y=i;} +if(sum<0){sum=0;x=i+1;} + +} +p.first=x; +p.second=y; +return p; +} + +int main() +{ +int n; +cin>>n; +ll arr[n]; +for(ll i=0;i>arr[i]; +pairp=maxsum(arr,n); +cout< +using namespace std; +typedef long long int ll; +int countingValleys(int n, string s) { + + +int sum=0; +if(s[0]=='U')sum++; +else sum--; +int count=0; +if(sum<0)count++; +for(int i=1;i>n; +string s; +cin>>s; +cout<