Given an array of positive integers. Find the maximum sum of strictly increasing subarrays.
 
Example 1:
Input : 
arr[] = {1, 2, 3, 2, 5, 1, 7}
Output : 
8
Explanation :
Some Strictly increasing subarrays are -
{1, 2, 3} sum = 6,
{2, 5} sum = 7,
{1, 7} sum = 8,
maximum sum = 8
 
Example 2:
Input:
arr[] = {1, 2, 2, 4}
Output:
6
Your Task:  
You don't need to read input or print anything. Your task is to complete the function maxsum_SIS() which takes the array arr[] and its size N as inputs and returns the required result.
 
Expected Time Complexty: O(N)
Expected Auxiliary Space: O(1)
 
Constraints:
1 ≤ N ≤ 10^{5}
1 ≤ A[i] ≤ 1000

Source: geeksforgeeks | Difficulty: EASY

Starter code: #User function Template for python3

class Solution:
    def maxsum_SIS(self, arr, n): 
        # Your code goes here   

Solutions:
class Solution:

	def maxsum_SIS(self, arr, n):
		curr = arr[0]
		max1 = arr[0]
		for i in range(len(arr) - 1):
			if arr[i] < arr[i + 1]:
				curr += arr[i + 1]
				if curr > max1:
					max1 = curr
			else:
				curr = arr[i + 1]
		return max1


class Solution:

	def maxsum_SIS(self, arr, n):
		m = arr[0]
		c = arr[0]
		for i in range(n - 1):
			if arr[i] < arr[i + 1]:
				c += arr[i + 1]
				if c > m:
					m = c
			else:
				c = arr[i + 1]
		return m


class Solution:

	def maxsum_SIS(self, arr, n):
		if n == 1:
			return arr[0]
		maxSum = arr[0]
		sum = arr[0]
		for i in range(1, n):
			if arr[i] <= arr[i - 1]:
				sum = 0
			sum = sum + arr[i]
			maxSum = max(maxSum, sum)
		return maxSum


class Solution:

	def maxsum_SIS(self, arr, n):
		summ = arr[0]
		ans = -float('inf')
		for i in range(1, n):
			if arr[i - 1] < arr[i]:
				summ += arr[i]
			else:
				ans = max(summ, ans)
				summ = arr[i]
		return max(ans, summ)


class Solution:

	def maxsum_SIS(self, arr, n):
		mx = 0
		sm = arr[0]
		le = arr[0]
		for i in range(1, n):
			if le < arr[i]:
				sm += arr[i]
				le = arr[i]
			else:
				if sm > mx:
					mx = sm
				sm = arr[i]
				le = arr[i]
		if sm > mx:
			mx = sm
		return mx