Question: Given a non-empty array arr with n Integers both positive and negative, find the maximum sum contiguous subarray within arr which has the large def
Given a non-empty array arr with n Integers both positive and negative, find the maximum sum contiguous subarray within arr which has the large def solutionB(arr): len(arn) max so far = arr[@] for i in range(n): sum= for j in range(i, n): sum += arr[] if sum > sum so far: max_so_far sum return max_so_far What is the runtime of this solution (using big-O notation)? O(n) On 21 On-3) Oln logni
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
