#!/bin/python3

## EPIP 24.5 Contiguous increasing sub array
class Solution:

	def longestContiguousIncreasing(self, A):
		
		if not A:
			raise ValueError("Expecting array")
			
		prev_start = 0
		prev_max   = 1
		current_start = 0
		current_max = 1
		
		for i in range(1, len(A)):
			
			if A[i]>A[i-1]:
				current_max +=1
			else:
				if current_max>prev_max:
					prev_max = current_max
					prev_start = current_start
				
				current_start = i
				current_max = 1
						
		if current_max > prev_max:
			return (current_start, current_start+current_max-1)
		else:
			return (prev_start, prev_start+prev_max-1)							
    		
def main():

	sol = Solution()
	
	A = [2,11,3,5,13, 7,19,17,23]
	indexes = sol.longestContiguousIncreasing(A)
	
	
	print(indexes)
	print("Elements b/w:", A[indexes[0]], A[indexes[1]])	
	
if __name__=="__main__":main()
