You are viewing a single comment's thread. Return to all comments →
My Javascript solution
function getWays(squares, d, m){ var ways = 0, i = 0, sum = 0, j = 0, index = 0; if(squares.length === 1 && squares[0] === d){ return 1; } for(i = 0; i < squares.length - (m -1); i++){ sum = 0; index = i; for(j = 0; j < m; j++){ sum += squares[index++] } if(sum === d){ ways++; } } return ways; }
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 →
My Javascript solution