Facebook Interview Question for Software Developers
- 0of 0 votes
You are given an array A of size N and Q queries. For each query, you are given two indices of the array L and R. The subarray generated from L to R is reversed. Your task is to determine the maximum sum of the subarrays.- Sameer October 29, 2018 in United States
Note: After each query is solved, the array comes to its initial states.
First line: Two space-separated integers N and Q
Next line: N space-separated integers denoting the array elements.
Q lines: Two space-separated integers in every line denoting the values of Li and Ri
For each query, print the required answer in a new line.
3 -1 4 2 -1
| Report Duplicate | Flag | PURGE
Facebook Software Developer
Open Chat in New Window