Company: Lokal_App_12_jan
Difficulty: medium
Longest Balanced Subarray Longest Balanced Subarray Problem Statement You are given an array of integers n . Your task is to find the length of the longest subarray where the sum of positive numbers is equal to the sum of negative numbers. A positive number is greater than zero, and a negative number is less than zero. The subarray can contain zero, but zeros do not affect the sum of positives or negatives. Note: The problem statement implies that a subarray is "balanced" if the sum of its positive elements is equal to the absolute value of the sum of its negative elements. This is equivalent to finding the longest subarray with a total sum of 0. Your code should dynamically allocate memory for the array and manipulate it using pointers. Input Format The first line contains an integer n , the size of the array. The next n lines contain the elements of the array. Output Format Print the length of the longest subarray where the sum of positive numbers equals the sum of negative numbers.