Subarray Division 1

  • + 0 comments

    c++20

    int birthday(vector<int> s, int d, int m) {
        int nCombos = 0;
        for(int i = 0; i < s.size() ; i++){
            if(std::accumulate(s.begin() + i, s.begin() + i + m, 0) == d){
                nCombos +=1;
            }
        }
        return nCombos;
    }