FastPrepMaximum Subarray
Problems/Maximum Subarray

Maximum Subarray

Bloomberg LP logoBloomberg LP● EasyNEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names this well-known problem directly in the Bloomberg new-grad phone screen. We kept the standard task: the largest sum of a non-empty run of neighbors. The result is a 64-bit number so it works the same in every language.

Given an integer array nums, return the largest possible sum of a nonempty contiguous subarray.

Function

maxSubArray(nums: int[]) → long

Examples

Example 1

nums = [-2,1,-3,4,-1,2,1,-5,4]return = 6

The subarray [4,-1,2,1] has the maximum sum 6.

Example 2

nums = [1]return = 1

The only nonempty subarray is the single element.

Example 3

nums = [-8,-3,-6,-2,-5,-4]return = -2

When every value is negative, the best nonempty subarray is the largest individual value.

Constraints

  • 1 <= nums.length <= 100000.
  • -1000000000 <= nums[i] <= 1000000000.
  • The answer fits in a signed 64-bit integer.

More Bloomberg LP Phone Screen questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Best Time to Buy and Sell StockAmazon · ONSITE INTERVIEW
  • Best Time to Buy and Sell StockMeta · PHONE SCREENMeta interview questions
  • Speed Up a Slow FunctionCitadel · OA · PHONE SCREENCitadel interview questions
  • Best Time to Buy and Sell StockSwiggy · PHONE SCREEN
  • Best Time to Buy and Sell StockKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Suffix Maximum Frequency QueriesMicrosoft · PHONE SCREENMicrosoft interview questions
  • Best Time to Buy and Sell StockOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
  • Maximum SubarraySquarepoint Capital · ONSITE INTERVIEWSquarepoint Capital interview questions
  • Best Time to Buy and Sell StockJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions
  • Best Time to Buy and Sell StockZoox · ONSITE INTERVIEW

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public long maxSubArray(int[] nums) {
        // Write your code here.
    }

}
Checking account…