LeetCode: Maximum Subarray
Problem:
https://leetcode.com/problems/maximum-subarray/
Code:
# Using Kadane's Algorithm
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
current_sum=0
max_sum=float('-inf') # bcz list can have all elements as negat...
is-power-of-two.hashnode.dev1 min read