You are viewing a single comment's thread. Return to all comments →
Javascript solution (tried to simplify as much as possible):
function solve(s, d, m) { let result = 0; for (let i = 0, l = s.length; i < l; i++) { if (s.slice(i, i + m).reduce((x, y) => x + y) === d) { result++; } } return result; }
Subarray Division
You are viewing a single comment's thread. Return to all comments →
Javascript solution (tried to simplify as much as possible):