702A Codeforces - Maximum increase


702A Codeforces - Maximum increase







Solution in C++


#include <bits/stdc++.h>

using namespace std;

#define pii pair<int,int>
typedef long long int lli;

int n,m=1;
string inp;
int lon[100005],arr[100005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=0;i<n;i++)cin>>arr[i];
    for(int i=0;i<n;i++)
    {
        lon[i]=1;
        if(arr[i-1]<arr[i])lon[i]=max(lon[i],lon[i-1]+1);
    }
    cout<<*max_element(lon,lon+n);
    return 0;
}

Share on Google Plus

About Mohamed Sobhi

My name is Mo.Sobhy ,I study at School excelling high school in Ain Shams ,Cairo
My hobbies is programming ,and web development ,playing chess and writing horror stories.
    Blogger Comment
    Facebook Comment

0 التعليقات:

إرسال تعليق