FastPrepThree-Part Splits With a Light Middle
Problems/Three-Part Splits With a Light Middle

Three-Part Splits With a Light Middle

DocuSign logoDocuSign● MediumINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A report from May 2025 lists this in its first interview round. You cut an array into three non-empty parts in a row. You count the splits whose middle sum is no bigger than the two outer sums together.

The report gives no limits or examples, and it does not say whether numbers can be negative. Here the array has 3 to 3,000 numbers from -10,000 to 10,000, so negatives and zeros are allowed. Two splits differ when a cut is in a different place. We wrote the examples.

Our version is about 90% the same as the reported question.

You are given an array values of n integers. Cut it in two places so it becomes three parts in a row: a left part, a middle part and a right part. Each part must hold at least one number, and the numbers keep their order.

Let S1, S2 and S3 be the sums of the left, middle and right parts. A split has a light middle when S2 <= S1 + S3. Equal sums count.

  • Numbers can be negative or zero.
  • Two splits are different when at least one cut is in a different place.

Return the number of splits with a light middle.

Function

countLightMiddleSplits(values: int[]) → int

Examples

Example 1

values = [2,5,1,1]return = 1

There are 3 ways to cut 4 numbers into 3 parts. [2] | [5] | [1,1]: the middle sum 5 is more than 2 + 2 = 4, so it fails. [2] | [5,1] | [1]: 6 is more than 2 + 1 = 3, so it fails. [2,5] | [1] | [1]: 1 is at most 7 + 1 = 8, so it counts. The answer is 1.

Example 2

values = [3,-2,4,-1,2]return = 5

The total is 6, so a split counts when its middle sum is at most 3. The 6 splits have middle parts [-2] (sum -2), [-2,4] (2), [-2,4,-1] (1), [4] (4), [4,-1] (3) and [-1] (-1). Only [4] fails. For [4,-1] the outer parts are [3,-2] and [2], with sums 1 and 2, and 3 <= 1 + 2 holds with equality. The answer is 5.

Example 3

values = [1,10,1]return = 0

Three numbers allow only one split, [1] | [10] | [1]. The middle sum 10 is more than 1 + 1 = 2, so the answer is 0.

Constraints

  • 3 <= values.length <= 3000
  • -10^4 <= values[i] <= 10^4

More DocuSign Onsite Interview questions

  • Count Binary SubstringsONSITE INTERVIEW · Seen Sep 2026
  • Two Positions That Add Up to a TargetPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Compress Consecutive Integer RangesONSITE INTERVIEW · Seen Aug 2026
  • JSON Schema Object ValidatorONSITE INTERVIEW · Seen Aug 2026
  • Most Transactions Kept Without Going NegativeONSITE INTERVIEW · Seen May 2025
  • Combine Two Sorted Lists Into OneONSITE INTERVIEW · Seen Apr 2022
  • Exact Palindrome CheckPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2022
  • Paired Words That Share a SubstringONSITE INTERVIEW · Seen Apr 2022
  • Reverse the Characters of a TextPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2022
  • Reverse the Order of a Linked ListONSITE INTERVIEW · Seen Feb 2020

Similar questions at other companies

  • Count Subarrays with Equal Even and Odd CountsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Range Booking TotalsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Product of Array Except SelfWalmart Labs · ONSITE INTERVIEW
  • Subarrays Whose Sum Is a Power of TwoKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Maximize Compatible Car RidersUber Freight · PHONE SCREEN · ONSITE INTERVIEWUber Freight interview questions
  • Count Subarrays with Sum KMakeMyTrip.com · ONSITE INTERVIEWMakeMyTrip.com interview questions
  • Product Of Array Except SelfInfosys · ONSITE INTERVIEWInfosys interview questions
  • Centered K-by-K Submatrix SumsCitadel · ONSITE INTERVIEWCitadel interview questions
  • Farthest Affordable Shop per QueryAdobe · ONSITE INTERVIEWAdobe interview questions
  • Product of Array Except SelfSquarepoint Capital · ONSITE INTERVIEWSquarepoint Capital interview questions

Interview reports that mention this question

  • DocuSign SWE Intern Interviews: 27 Experiences (Part 2 of 2)
  • DocuSign SWE Intern OA Questions: 53 Experiences (Part 1 of 2)
All DocuSign interview questionsSee DocuSign hiring insights
Saved
class Solution {
    public int countLightMiddleSplits(int[] values) {
        // Write your code here.
    }
}
Checking account…