Skip to content

Instantly share code, notes, and snippets.

@MohamedTaha98
Created July 26, 2017 19:46
Show Gist options
  • Save MohamedTaha98/9e8e4fbdda39e45d9429232a3a15b718 to your computer and use it in GitHub Desktop.
Save MohamedTaha98/9e8e4fbdda39e45d9429232a3a15b718 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
long n, length = 1;
cin >> n;
long ar[n];
for (int i = 0; i < n; i++)
cin >> ar[i];
if (n == 1) {
cout << "1";
return 0;
}
for (int i = 0; i < n - 1; i++) {
if (ar[i] < ar[i + 1])
length++;
else
length = 1;
ar[i] = length;
if (i == n - 2)
ar[n - 1] = length;
}
long max = ar[0];
for (int i = 0; i < n; i++) {
if (ar[i] > max)
max = ar[i];
}
cout << max;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment