Python code without using stack


#1

Hi,
I came up with the below solution where I’m not using the stack. I’m just looking for the positive slope while going through the array and whenever it is found I check for any successive numbers that are less than the small value that is contributing to the slope. I also update the low and high when I find another pair contributing to the positive slope

class Solution:
    # @param A : list of integers
    # @return an integer
    def solve(self, A):
        low = -2**32
        high = A[0]
        p = A[0]
      
        # Traverse given array 
        for value in A:  
            #NOTE:value is equal to pre[i] according to the  
            #given algo    
          
            # If we find a node who is on the right side 
            # and smaller than root, return False 
            if value < low : 
                return 0 
          
            if value > p:
                low = p
                high = value
    
            p = value
    
        return 1

#2

Would you please explain what is use of high here, why are we updating high if we are not using it anywhere?