Counting Subarrays! Time : Space : 123456789101112int Solution::solve(vector<int> &A, int B) { int res = 0, sum = 0, l = 0; for(int i = 0; i < A.size(); i++) { sum += A[i]; while(l < i and sum >= B) sum -= A[l++]; if(sum < B) { res += i - l + 1; } } return res;}