Find Largest Sum Contiguous Subarray
Updated
Problem statement
You are given a list of integers inputArr. It can hold both positive and negative numbers.
A continuous sequence is one or more neighboring elements of the list. Return the largest sum of any continuous sequence.
Function
findLargestSumContiguousSubarray(inputArr: int[]) → intExamples
Example 1
inputArr = [2, -8, 3, -2, 4, -10]return = 5The given list is (2, -8, 3, -2, 4, -10), and we take (3, -2, 4) as the continuous sequence for getting the largest sum. The sum is 3+ (-2) +4, which is 5.
Constraints
1 ≤ inputArr.length ≤ 10^5-10^4 ≤ inputArr[i] ≤ 10^4
More Cisco interview questions
- Check if a String Is a PalindromePHONE SCREEN · Seen Nov 2026
- Find Unique ElementsPHONE SCREEN · Seen Nov 2026
- First Letter to Appear TwicePHONE SCREEN · Seen Nov 2026
- Middle of a Linked ListPHONE SCREEN · Seen Nov 2026
- Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
- Reverse a StringPHONE SCREEN · Seen Nov 2026
- Valid ParenthesesPHONE SCREEN · Seen Nov 2026
- K-Step Bit Flip with RetentionPHONE SCREEN · Seen Nov 2026
- Todo Task Manager OperationsONSITE INTERVIEW · Seen Oct 2026
- Find the Duplicate Number Without Modifying the ArrayONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Speed Up a Slow FunctionCitadel · OA · PHONE SCREENCitadel interview questions
- Maximum Income from Asset TradingJefferies · OA
- Best Time to Buy and Sell StockFlexTrade · OAFlexTrade interview questions
- Count Sawtooth SubarraysHudson River Trading · OAHudson River Trading interview questions
- Maximum Total of Nonadjacent RatingsMorgan Stanley · OAMorgan Stanley interview questions
- Count Sawtooth SubarraysTikTok · OATikTok interview questions
- Count Alternating-Parity SubarraysVisa · OAVisa interview questions
- Maximum Sum of Non-Adjacent ElementsLSEG · OALSEG interview questions
- Maximum Score with Prime JumpsMicrosoft · OAMicrosoft interview questions
- Maximum Beauty by DeletionsMeesho · OA