
Asked in Housing.com
Maximum Sum Circular Subarray Problem Statement
Find the maximum possible sum of a non-empty subarray from a given circular array/list ARR
containing N
integers.
Explanation:
The array is circular, meaning the end of the list connects back to the beginning. A circular subarray may only include each element once.
Input:
The first line contains an integer 'T' indicating the number of test cases.
For each test case:
The first line contains an integer 'N', the number of elements in the array 'ARR'.
The second line contains 'N' space-separated integers representing the array 'ARR'.
Output:
Print the maximum possible sum of a non-empty subarray of 'ARR' for each test case, one per line.
Example:
Input:
ARR = [1, 2, -3, -4, 5]
Output:
8
Explanation: The subarray [5, 1, 2] forms the maximum sum of 8, as the array is circular.
Constraints:
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 105
- -105 ≤ ARR[i] ≤ 105
- Time Limit: 1 sec
Note:
The output for each test case continues automatically. You just need to implement the function.

AnswerBot
4mo
Find the maximum sum of a non-empty subarray from a circular array.
Identify the maximum sum of a non-empty subarray within the circular array
Consider both normal and circular subarrays to find the max...read more
Help your peers!
Add answer anonymously...
Top Software Developer Interview Questions Asked at Housing.com
Q. Given a rotated sorted array, how can you search for a target value efficiently ...read more
Q. Given a sorted array that has been rotated by some number of positions, find the...read more
Q. How would you add two integers that cannot be stored even in a long long int?
Interview Questions Asked to Software Developer at Other Companies
Top Skill-Based Questions for Housing.com Software Developer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

