We must use solution 1 now as they are O(n^2) subarrays that sum up to the given number. Example: an array of only 0s and a given sum of 0.
Given two arrays A[] and B[] of length N, the task is to find the minimum number of operations in which the array A can be converted into array B where each operation consists of adding any integer K into a subarray from L to R. Source:https://www.geeksforgeeks.org/minimum-number...