📅  最后修改于: 2022-03-11 15:01:09.147000             🧑  作者: Mango
//subdivision Array
function birthday(s, d, m) {
let count = 0
const length = s.length - m
for(let i=0;i<=length;i++) {
if(s.slice(i,i+m).reduce((a,b) => a+b)=== d) {
count++
}
}
console.log(count)
}
birthday([1,2,1,3,2],3,2)