Algorithm


A. Maximum Increase
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.

A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.

Input

The first line contains single positive integer n (1 ≤ n ≤ 105) — the number of integers.

The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).

Output

Print the maximum length of an increasing subarray of the given array.

Examples
input
Copy
5
1 7 2 11 15
output
Copy
3
input
Copy
6
100 100 100 100 100 100
output
Copy
1
input
Copy
3
1 2 3
output
Copy
3

 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
	int n, count = 0;
	priority_queue<int> q;

	cin >> n;

	vector<int> arr(n);

	for(int i = 0; i < n; i++) {
		cin >> arr[i];

		if(i == 0) {
			count++;
		} else if(arr[i-1] < arr[i]) {
			count++;
		} else {
			q.push(count);
			count = 1;
		}
	}

	if(count) {
		q.push(count);
	}

	cout << q.top() << endl;

	return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5
1 7 2 11 15

Output

x
+
cmd
3
Advertisements

Demonstration


Codeforces Solution-Maximum Increase-Solution in C, C++, Java, Python

Previous
Codeforces solution 1080-B-B. Margarite and the best present codeforces solution
Next
CodeChef solution DETSCORE - Determine the Score CodeChef solution C,C+