Company: Sap_20nov
Difficulty: medium
Task 2 Problem Description You are given an array A of integers. Find the maximum number of non-intersecting segments of length 2 (two adjacent elements), such that segments have an equal sum. For example, given A = [10, 1, 3, 1, 2, 2, 1, 0, 4], there are three non-intersecting segments, each whose sum is equal to 4: (1, 3), (2, 2), (0, 4). Another three non-intersecting segments are: (3, 1), (2, 2), (0, 4). Write a function: int solution(vector &A); that, given an array A of N integers, returns the maximum number of segments with equal sums. Examples Example 1: Input: A = [10, 1, 3, 1, 2, 2, 1, 0, 4] Output: 3 Explanation: There are three non-intersecting segments, each whose sum is equal to 4: (1, 3), (2, 2), (0, 4). Another three non-intersecting segments are: (3, 1), (2, 2), (0, 4). Example 2: Input: A = [5, 3, 1, 3, 2, 3] Output: 1 Explanation: Each sum of two adjacent elements is different from the others. Example 3: Input: A = [9, 9, 9, 9] Output: 2 Explanation: Segments (A[0],