작성
·
121
0
function solution(m, arr) {
let [left, right] = [0, 1];
let sum = arr[left];
let result = 0;
while (right <= arr.length) {
if (sum < m) {
sum += arr[right++];
} else if (sum > m) {
sum -= arr[left++];
} else {
sum -= arr[left++];
result++;
}
}
return result;
}