FastPrepMaximum Size Subarray Sum
Problems/Maximum Size Subarray Sum

Maximum Size Subarray Sum

The D.E. Shaw Group logoThe D.E. Shaw Group● MediumFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Given an array a, create another array b where b[i] is the size of the maximum subarray which includes a[i] and a[i] is the maximum element in that subarray.

Return the sum of all elements of array b.

Function

maximumSizeSubarraySum(a: int[]) → long

Complete the function maximumSizeSubarraySum in the editor.

maximumSizeSubarraySum has the following parameter:

  1. int a[]: an array of integers

Returns long: the sum of all elements of array b

Examples

Example 1

a = [10, 20, 10, 9, 12, 14]return = 17

The sum of all elements of array b is 1 + 6 + 2 + 1 + 3 + 4 = 17.

Constraints

  • a.length <= 105

More The D.E. Shaw Group interview questions

  • IPOPHONE SCREEN · Seen Nov 2026
  • Print Numbers in Turn with Three ThreadsPHONE SCREEN · Seen Nov 2026
  • Subarray Product Less Than KPHONE SCREEN · Seen Nov 2026
  • Koko Eating BananasPHONE SCREEN · Seen Nov 2026
  • Sum of Smallest Non-DivisorsPHONE SCREEN · Seen Nov 2026
  • Count Lucky TicketsOA · Seen Nov 2026
  • Count Palindrome Addition ChoicesOA · Seen Nov 2026
  • Coordinate Odd and Even Workers in OrderONSITE INTERVIEW · Seen Oct 2026
  • Minimum Taps to Water a GardenONSITE INTERVIEW · Seen Oct 2026
  • Remove the Fewest Magic BeansPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Sum of Subarray MinimumsNVIDIA · OANVIDIA interview questions
  • Shopkeeper Final Price SummaryMicrosoft · OAMicrosoft interview questions
  • Nested Recipe Blocks (Game Adaptation)Roblox · OARoblox interview questions
  • Maximum Capped Histogram Area After One RemovalMyntra · OAMyntra interview questions
  • Steps to the Next Higher Value in a CircleRippling · OARippling interview questions
  • Shopkeeper Final PriceUber · OAUber interview questions
  • Predict AnswerAmazon · OA
  • Retention Policy CollisionBox · OABox interview questions
  • Longest Prefix-Valid Binary SubarrayHackerRank · OAHackerRank interview questions
All The D.E. Shaw Group interview questionsSee The D.E. Shaw Group hiring insights
Saved
class Solution {
    public long maximumSizeSubarraySum(int[] a) {
      // write your code here
    }

}
Checking account…