Find the maximum subarray score where the score is first plus last minus the middle sum.
Unlock detailed company stats for this questionUpgrade
Given an array such as [3, 1, 2, 4, 5], calculate the maximum subarray score, where a subarray's score is its first element plus its last element minus the sum of its middle elements. Example: [3, 1, 2, 4] scores 4 + 3 - (1 + 2) = 4; the best valid subarray is [4, 5] with answer 9.
Format · Onsite DSA round, single question.
Community answers
No answers contributed by the community yet.
Related questions
Find the maximum subarray sum.Given an array, find the maximum-sum subarray whose first and last elements are equal.Find the maximum subarray productRelated courses

Course

Course
Course
