FastPrepCount Splits with Larger Left Sum
Problems/Count Splits with Larger Left Sum

Count Splits with Larger Left Sum

NVIDIA logoNVIDIA● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an NVIDIA online assessment for interns. The report leaves out the split endpoints and the number limits. We filled those in.

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

Given an integer array nums, count the places where the sum on the left is strictly greater than the sum on the right.

For this exercise, assume a split divides the array into two nonempty contiguous parts, keeping every element in its original order. A split after index i has left part nums[0..i] and right part nums[i+1..n-1], so 0 <= i < n - 1.

Count the split only when leftSum > rightSum. Equal sums do not count. Return the number of valid splits.

Function

countLeftGreaterSplits(nums: int[]) → int

Examples

Example 1

nums = [10,4,-8,7]return = 2

The three splits have left/right sums 10/3, 14/-1, and 6/7. Only the first two have a strictly larger left sum, so the answer is 2.

Example 2

nums = [1,1]return = 0

There is one split. Both sums are 1, so strict inequality fails and the answer is 0.

Example 3

nums = [-1,-2,-3]return = 1

The split sums are -1/-5 and -3/-3. The first split qualifies because -1 is greater than -5; the equal second split does not count.

Constraints

  • For this exercise, assume 2 <= nums.length <= 100000.
  • For this exercise, assume elements may be negative, zero, or positive, with -10^9 <= nums[i] <= 10^9.
  • The answer is at most nums.length - 1.

More NVIDIA Online Assessment questions

  • Query a Header-Encoded MatrixOA · Seen Oct 2026
  • Maximum ScoreOA · Seen Oct 2026
  • Address on Same PageOA · Seen Oct 2026
  • Minimize Task Resource ConsumptionOA · Seen Oct 2026
  • Minimum Project Bid CostOA · Seen Oct 2026
  • Count Ideal Numbers in a RangeOA · Seen Oct 2026
  • Generate Bit MaskOA · Seen Oct 2026
  • Reconstruct an Array from Prefix XOROA · Seen Oct 2026
  • Sum of Subarray MinimumsOA · Seen Oct 2026
  • Unique Integers That Sum to ZeroOA · Seen Oct 2026

Similar questions at other companies

  • Minimum Positive Starting ValueBooking.com · OA
  • Array Interval SumsHeadlands Technologies · OAHeadlands Technologies interview questions
  • Minimum AmountBelvedere Trading · OA
  • Online No-Intercept Linear RegressionTwo Sigma · OATwo Sigma interview questions
  • Range Sum QueriesIntuit · OAIntuit interview questions
  • Shortest Distance on a Circular Bus RouteAmazon · OA
  • Count Sortable SplitsGoogle · OAGoogle interview questions
  • Array Challenge (QR Intern)Akuna Capital · OAAkuna Capital interview questions
  • Range Negation UpdatesJP Morgan Chase · OAJP Morgan Chase interview questions
  • Threshold AlertsGoldman Sachs · OAGoldman Sachs interview questions

Interview reports that mention this question

  • NVIDIA OA: What It Tests (2026)

NVIDIA interview experiences

  • NVIDIA Full-Time SWE Onsite Scheduling: 1 Experience
  • NVIDIA DevOps, QA and Infra Intern Interviews: 12 Experiences
  • NVIDIA Ignite Internship OA Experience
  • NVIDIA Software Intern Interview Questions: 9 Experiences
  • NVIDIA Ignite SWE Intern OA Questions: 6 Experiences
All NVIDIA interview questionsSee NVIDIA hiring insights
Saved
class Solution {
    public int countLeftGreaterSplits(int[] nums) {
        // Count valid boundaries.
    }
}
Checking account…