• + 0 comments

    JS

    function birthday(s, d, m) {
        return s.slice(0,(s.length-m+1)).reduce((acc, el, idx)=>{
            if(s.slice(idx,idx+m).reduce((acc,val)=>val+acc)==d) return acc+1
            return acc
        },0)
    }