Maximum Sum
Practice
3.5 (19 votes)
Algorithms
Data structures
Easy
Hash maps
Hash tables
Sets
Problem
69% Success 5091 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given an array $$A$$ of $$N$$ integers. Now, you have to output the sum of unique values of the maximum subarray sum of all the possible subarrays of the given array $$A$$.
Note: Subarray means contiguous elements with atleast one element in it.

Input Format

The first line of the input contains a single integer $$N$$, the total number of elements in array $$A$$.
The next line of the input contains $$N$$ space-separated integers representing the elements of the array.

Output Format

The only single line of the output should contain a single integral value representing the answer to the problem.

Constraints

$$1 \le N \le 2000$$
$$0 \le |A_i| \le 10^9$$

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
17 votes
Tags:
Data StructuresEasyHash MapsHash TablesImplementation
Points:20
4 votes
Tags:
Data StructuresHash TablesBasics of Hash TablesReal world
Points:20
26 votes
Tags:
AlgorithmsEasy