Company: Zeta_4August
Difficulty: medium
Debugging - Finding subsequence Problem Description You are given a code for the following problem statement in the findSubsequenceFunction . However, the solution fails the test cases because there are bugs in the code. Your task is to find and fix all the bugs so that it passes all the test cases. You are given the following: N : An integer A : An array of integers where the value of elements is either 1 or -1. A query consists of two integers, L and R . For a query you have to find the maximum possible length of a subsequence chosen from subarray A[L...R] , which follows the given condition: If the length of subsequence is K , say subsequence is b 1 , b 2 , ..., b K , then, All prefix sums of the subsequence are non-negative. The sum of all elements in the subsequence is 0. If no such subsequence exists, you should output 0. Task: You have to process Q -independent queries, where in each query, you have to determine the length of the maximum possible subsequence. Notes: 1-based Inde