






'''simple docstring'''





from collections.abc import Sequence



def        __snake_case						(__UpperCAmelCase       ,	__UpperCAmelCase = False    ):





	"""simple docstring"""
	if not arr:
		return 0

	lowerCamelCase_					:  List[str]						=    0 if allow_empty_subarrays else float('''-inf'''    )
	lowerCamelCase_					:  Any						=    0.0
	for num in arr:
		lowerCamelCase_					:  Dict						=    max(0 if allow_empty_subarrays else num       ,	curr_sum + num    )
		lowerCamelCase_					:  Union[str, Any]						=    max(_lowerCamelCase       ,	_lowerCamelCase    )

	return max_sum


if __name__ == "__main__":
			from doctest import testmod

			testmod()

			__lowerCamelCase						:    List[str]     				=  [-2, 1, -3, 4, -1, 2, 1, -5, 4]
			print(f"""{max_subarray_sum(nums) = }""")













'''simple docstring'''

__lowerCAmelCase				:      List[str]						      ="Alexander Joslin"

import operator as op

from .stack import Stack





def 		UpperCamelCase							(				_lowerCamelCase   :   str			):
    A__							=     {"*": op.mul, "/": op.truediv, "+": op.add, "-": op.sub}

    A__							=     Stack()
    A__							=     Stack()

    for i in equation:
        if i.isdigit():
            # RULE 1
            operand_stack.push(int(_lowerCamelCase			)			)
        elif i in operators:
            # RULE 2
            operator_stack.push(_lowerCamelCase			)
        elif i == ")":
            # RULE 4
            A__							=     operator_stack.peek()
            operator_stack.pop()
            A__							=     operand_stack.peek()
            operand_stack.pop()
            A__							=     operand_stack.peek()
            operand_stack.pop()

            A__							=     operators[opr](_lowerCamelCase		,			_lowerCamelCase			)
            operand_stack.push(_lowerCamelCase			)

    # RULE 5
    return operand_stack.peek()


if __name__ == "__main__":
  __lowerCAmelCase				:      Dict						      ="(5 + ((4 * 2) * (2 + 3)))"
  # answer = 45
  print(f"""{equation} = {dijkstras_two_stack_algorithm(equation)}""")



