Problem · Array
Find Largest Sum of Continuous Sequence
Learn this problemProblem statement
You are given a list of integers (both positive and negative). Find the continuous sequence of integers with the largest sum.
Write an algorithm to find the largest sum of the continuous sequence from the given list.
Input
The first line of input consists of an integer - inputArr_size, representing the size of the list (N). The next line consists of N space-separated integers representing the elements of the list.
Output
Print an integer representing the largest sum of the continuous sequence from the given list.
Function
maxSubArraySum(nums: int[]) → intExamples
Example 1
nums = [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.
So, the output is 5.
Constraints
🥑🥑More Cisco problems
- Collect CoinsSeen Jun 2025
- FizzBuzz ProblemSeen May 2025
- Find Largest Sum Contiguous SubarraySeen May 2025
- Find Palindrome Sub-stringSeen May 2025
- Count Numbers with Digit SumSeen Mar 2025
- Maximum Chocolates from Jars (L.C. 198 :)Seen Mar 2025
- Find Elements Largest in Row Smallest in ColumnSeen Mar 2025
- Find Maximum DifferenceSeen Mar 2025