The purpose of the program is to add 2 sides of an array starting from the bottom and top of both ends and to find the lowest difference at equal decrements of iteration. The program functions but it's slow.int solution(vector<int> &A) {    int n = A.size();    int i, j, rsum, lsum, difference;    int currentmindifference = 1000;    for(i = 0; i < n; i++)    {        lsum = 0;        rsum = 0;        for(j = 0; j <= i; j++) lsum += A[j];        for(j = i + 1; j < n; j++) rsum += A[j];        difference = abs (lsum - rsum);        if (difference < currentmindifference) currentmindifference = difference;    }    return currentmindifference;}
Adding two sides of an array
c++;optimization;performance;algorithm