Skip to content

Instantly share code, notes, and snippets.

View christianbiring1's full-sized avatar
🎯
Focusing

Christian Biringanine christianbiring1

🎯
Focusing
View GitHub Profile
@christianbiring1
christianbiring1 / Birthday cake hackerrank Subarray division
Last active August 31, 2022 08:10
Two children, Lily and Ron, want to share a chocolate bar. Each of the squares has an integer on it.
function birthday(s, d, m) {
// Write your code here
let result = 0;
for(let i = 0; i < s.length; i++) {
if (s.slice(i, i + m).reduce((r, v) => r + v, 0) === d) {
result++;
}
}
return result;
}