You are viewing a single comment's thread. Return to all comments →
function reduce(pieces) { return pieces.reduce((sum, val) => sum += val, 0); } function solve(n, s, d, m) { var count = 0; for (var i = 0; i < n; i++) { if (reduce(s.slice(i, i + m)) === d) count++; } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division
You are viewing a single comment's thread. Return to all comments →