Given an array containing n numbers. The problem is to find the length of the longest contiguous subarray such that every element in the subarray is strictly greater than its previous element in the same subarray.
 
Example 1:
Input:
n = 9
a[] = {5, 6, 3, 5, 7, 8, 9, 1, 2}
Output:
5
 
Example 2:
Input:
n = 10
a[] = {12, 13, 1, 5, 4, 7, 8, 10, 10, 11}
Output:
4
 
Your Task:  
You don't need to read input or print anything. Your task is to complete the function lenOfLongIncSubArr() which takes the array a[] and its size n as inputs and returns the length of the longest increasing subarray.
 
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(1)
 
Constraints: 
1<=n<=10^{5}
1<=a[i]<=10^{5}

Difficulty: EASY
Tags: Data structures
Skill types: Data structures
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
    def lenOfLongIncSubArr(self, a, n):
        #Code here
    
    
    

Solutions:
class Solution:

	def lenOfLongIncSubArr(self, a, n):
		c = 1
		l = 1
		a = list(map(int, a))
		for i in range(n - 1):
			if a[i] < a[i + 1]:
				c += 1
			else:
				l = max(l, c)
				c = 1
		l = max(l, c)
		return l


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		a = list(map(int, a))
		inc = 1
		longest = 1
		for i in range(n - 1):
			if a[i] < a[i + 1]:
				inc += 1
			else:
				longest = max(longest, inc)
				inc = 1
		longest = max(longest, inc)
		return longest


class Solution:

	def lenOfLongIncSubArr(self, arr, n):
		arr = [int(x) for x in arr]
		dp = [1] * n
		for i in range(1, n):
			if arr[i] > arr[i - 1]:
				dp[i] = 1 + dp[i - 1]
		return max(dp)


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		ans = 1
		temp = 1
		for i in range(1, n):
			if int(a[i]) > int(a[i - 1]):
				temp += 1
				ans = max(ans, temp)
			else:
				temp = 1
		return ans


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		arr = []
		for i in a:
			arr.append(int(i))
		ma = []
		j = 1
		for i in range(0, n - 1):
			if arr[i] < arr[i + 1]:
				j += 1
			else:
				ma.append(j)
				j = 1
		ma.append(j)
		return max(ma)


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		makx = 1
		C = 1
		a = list(map(int, a))
		for i in range(n - 1):
			if a[i] < a[i + 1]:
				C += 1
			else:
				makx = max(makx, C)
				C = 1
		return max(makx, C)


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		a = [int(x) for x in a]
		max_count = 1
		count = 1
		if n == 1:
			return count
		for index in range(n - 1):
			if a[index + 1] > a[index]:
				count += 1
			else:
				max_count = max_count if max_count > count else count
				count = 1
		max_count = max_count if max_count > count else count
		return max_count


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		maxi = 0
		total = 1
		a = list(map(int, a))
		for i in range(n - 1):
			if a[i] < a[i + 1]:
				total += 1
			else:
				maxi = max(maxi, total)
				total = 1
		maxi = max(maxi, total)
		return maxi


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		a = list(map(int, a))
		res = 1
		length = 1
		for i in range(1, len(a)):
			if a[i] > a[i - 1]:
				length += 1
				res = max(res, length)
			else:
				length = 1
		return res


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		m_count = 0
		count = 0
		for i in range(1, n):
			if int(a[i]) > int(a[i - 1]):
				count += 1
				m_count = max(m_count, count)
			else:
				count = 0
		return m_count + 1


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		a = list(map(int, a))
		m = 1
		count = 1
		for i in range(n - 1):
			if int(a[i + 1] > a[i]):
				count += 1
			else:
				m = max(m, count)
				count = 1
		m = max(m, count)
		return m


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		g = 1
		c = 0
		for i in range(1, n):
			if int(a[i - 1]) < int(a[i]):
				c = c + 1
				g = max(g, c + 1)
			else:
				c = 0
		return g


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		numbers = a
		count = 1
		countArr = []
		if n == 1:
			return 1
		for (index, item) in enumerate(numbers):
			if index > 0:
				k = index - 1
				if numbers[index] == numbers[k]:
					count = 1
				if int(numbers[index]) > int(numbers[k]):
					count = count + 1
				else:
					countArr.append(count)
					count = 1
				countArr.append(count)
		countArr.sort(reverse=True)
		return countArr[0]


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		ccount = 0
		mcount = 1
		for i in range(1, n):
			if int(a[i - 1]) < int(a[i]):
				ccount += 1
				mcount = max(mcount, ccount + 1)
			else:
				ccount = 0
		return mcount


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		c = 1
		cc = 1
		a1 = [int(i) for i in a]
		for i in range(1, n):
			if a1[i] > a1[i - 1]:
				c += 1
			else:
				if c > cc:
					cc = c
				c = 1
		if c > cc:
			return c
		if len(a) == 1:
			return 1
		elif a[1] > a[0] and len(a) == 2:
			return 2
		else:
			return cc


class Solution:

	def lenOfLongIncSubArr(self, arr, n):
		c = 1
		lon = 1
		arr = list(map(int, arr))
		ans = []
		for i in range(n - 1):
			if arr[i] < arr[i + 1]:
				c += 1
			else:
				lon = max(lon, c)
				c = 1
		lon = max(lon, c)
		return lon


class Solution:

	def lenOfLongIncSubArr(self, arr, n):
		c = 1
		arr = list(map(int, arr))
		ans = []
		for i in range(n - 1):
			if arr[i] < arr[i + 1]:
				c += 1
			else:
				ans.append(c)
				c = 1
			if i == n - 2:
				ans.append(c)
		if n == 1 or len(ans) == 0:
			return 1
		else:
			return max(ans)


from collections import deque

class Solution:

	def lenOfLongIncSubArr(self, a, n):
		sequence = deque()
		length_count = []
		prev = float('-inf')
		for val in a:
			val = int(val)
			if prev > val:
				length_count.append(len(sequence))
				sequence.clear()
			if val != prev:
				sequence.append(val)
				prev = val
		if len(sequence) > 0:
			length_count.append(len(sequence))
		return max(length_count)


class Solution:

	def lenOfLongIncSubArr(self, arr, n):
		arr = list(map(int, arr))
		res = 1
		count = 1
		prev = arr[0]
		for i in range(1, n):
			if arr[i] > prev:
				count += 1
			else:
				res = max(res, count)
				count = 1
			prev = arr[i]
		res = max(res, count)
		return res


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		length = 1
		i = 1
		temp = 1
		while i < n:
			if int(a[i]) > int(a[i - 1]):
				temp += 1
			else:
				length = max(length, temp)
				temp = 1
			i += 1
		return max(length, temp)


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		a = [int(i) for i in a]
		ans = 1
		count = 1
		current = a[0]
		for i in a[1:]:
			if i > current:
				count += 1
			else:
				ans = max(ans, count)
				count = 1
			current = i
		ans = max(ans, count)
		return ans


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		i = 0
		c = 1
		a = list(map(int, a))
		while i < n:
			k = 1
			x = i
			while i + 1 < n and a[i] < a[i + 1]:
				k += 1
				i += 1
			c = max(c, k)
			i += 1
		return c


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		a = list(map(int, a))
		c = 1
		ma = 0
		for i in range(len(a) - 1):
			if a[i] < a[i + 1]:
				c += 1
			else:
				ma = max(ma, c)
				c = 1
		ma = max(ma, c)
		return ma


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		maxlen = 1
		len = 1
		for i in range(1, n):
			if int(a[i]) > int(a[i - 1]):
				len += 1
			else:
				len = 1
			maxlen = max(maxlen, len)
		return maxlen


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		a = list(map(int, a))
		c = []
		d = 1
		t = 0
		if n == 1:
			return 1
		for i in range(1, n):
			if a[i] > a[i - 1]:
				d += 1
				t = d
			else:
				c.append(d)
				d = 1
		c.append(t)
		p = 0
		for j in range(len(c)):
			if p < c[j]:
				p = c[j]
			else:
				pass
		return p


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		res = 0
		maxi = 0
		for i in range(1, len(a)):
			if int(a[i]) > int(a[i - 1]):
				res += 1
				maxi = max(maxi, res)
			else:
				res = 0
		return maxi + 1


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		prev = -1
		len = 0
		max_len = 0
		for i in a:
			if prev < int(i):
				len += 1
				max_len = max(len, max_len)
			else:
				len = 1
			prev = int(i)
		return max_len


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		if len(a) == 1:
			return 1
		l = list(map(int, a))
		count = 1
		maxi = -2 ** 31
		for i in range(n - 1):
			if l[i] < l[i + 1]:
				count = count + 1
			else:
				maxi = max(maxi, count)
				count = 1
		maxi = max(maxi, count)
		return maxi


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		a = list(map(int, a))
		ans = 0
		t = 1
		for i in range(n - 1):
			if a[i] < a[i + 1]:
				t += 1
			else:
				ans = max(ans, t)
				t = 1
		ans = max(ans, t)
		return ans


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		m = 1
		o = 0
		for i in range(0, n - 1):
			if int(a[i + 1]) > int(a[i]):
				m += 1
			else:
				if m > o:
					o = m
				m = 1
		if m > o:
			return m
		return o


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		result = -1
		streak = 1
		for i in range(1, n):
			if int(a[i]) > int(a[i - 1]):
				streak += 1
			else:
				result = max(result, streak)
				streak = 1
		return max(result, streak)

def main():
	T = int(input())
	while T > 0:
		n = int(input())
		a = [x for x in input().strip().split()]
		print(Solution().lenOfLongIncSubArr(a, n))
		T -= 1
if __name__ == '__main__':
	main()


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		sub_arr = []
		ans = 0
		for i in a:
			i = int(i)
			if not sub_arr:
				sub_arr.append(i)
			elif i > sub_arr[-1]:
				sub_arr.append(i)
			else:
				ans = max(ans, len(sub_arr))
				sub_arr = [i]
		return max(ans, len(sub_arr))

def main():
	T = int(input())
	while T > 0:
		n = int(input())
		a = [x for x in input().strip().split()]
		print(Solution().lenOfLongIncSubArr(a, n))
		T -= 1
if __name__ == '__main__':
	main()


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		arr = list(map(lambda x: int(x), a))
		temp = 1
		maxInc = 0
		for itr in range(1, n):
			if arr[itr - 1] < arr[itr]:
				temp += 1
			else:
				if maxInc < temp:
					maxInc = temp
				temp = 1
		if temp > maxInc:
			maxInc = temp
		return maxInc

def main():
	T = int(input())
	while T > 0:
		n = int(input())
		a = [x for x in input().strip().split()]
		print(Solution().lenOfLongIncSubArr(a, n))
		T -= 1
if __name__ == '__main__':
	main()


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		mc = 1
		count = 1
		for i in range(n - 1):
			if int(a[i]) < int(a[i + 1]):
				count += 1
			else:
				mc = max(count, mc)
				count = 1
		m = max(count, mc)
		return m

def main():
	T = int(input())
	while T > 0:
		n = int(input())
		a = [x for x in input().strip().split()]
		print(Solution().lenOfLongIncSubArr(a, n))
		T -= 1
if __name__ == '__main__':
	main()


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		currLen = 1
		maxLen = 0
		a = list(map(int, a))
		for i in range(1, n + 1):
			if i < len(a) and a[i] > a[i - 1]:
				currLen += 1
			else:
				if currLen > maxLen:
					maxLen = currLen
				currLen = 1
		return maxLen

def main():
	T = int(input())
	while T > 0:
		n = int(input())
		a = [x for x in input().strip().split()]
		print(Solution().lenOfLongIncSubArr(a, n))
		T -= 1
if __name__ == '__main__':
	main()


class Solution:

	def lenOfLongIncSubArr(self, a, n):
		if n == 1:
			return 1
		i = 1
		j = 0
		res = 0
		while i < n:
			if int(a[i]) > int(a[i - 1]):
				i += 1
			else:
				res = max(res, i - j)
				j = i
				i += 1
		return max(res, i - j)