Created
July 26, 2017 19:46
-
-
Save MohamedTaha98/9e8e4fbdda39e45d9429232a3a15b718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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