Maximum Subarray (Kadane's Algo) (Leetcode 53)
Problem Link: https://leetcode.com/problems/maximum-subarray/
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
meh=float('-inf')
msf=float('-inf')
for i in nums:
meh=meh+i
if(i>meh):
meh=i
if(meh>msf):
msf=meh
return msf
PreviousProduct of Array Except Itself (Leetcode 238) (DCP 2)NextMaximum Product Subarray (Leetcode 152)
Last updated