Minimum removal of elements from end of an array required to obtain sum K

  #include using namespace std;  int minSizeArr(int A[], int N, int K){            int leftTaken = N, rightTaken = N;          int leftSum = 0, rightSum = 0;          for (int left = -1; left < N; left++) {          if (left != -1)            leftSum += A[left];          rightSum = 0;                  for (int right = N - 1; right > left; right–) {              rightSum += A[right];              if (leftSum + rightSum == K) {                                                                                  if (leftTaken + rightTaken                    > (left + 1) + (N – right)) {                      leftTaken = left + 1;                    rightTaken = N – right;                }                break;            }                        if (leftSum + rightSum > K)                break;        }    }      if (leftTaken + rightTaken