• + 0 comments
    static int birthday(List<Integer> s, int d, int m) {
        int count = 0;
    
        for(int i=0; i<= s.size() - m; i++) {
            if( s.subList(i, i+m).stream().mapToInt(n -> n).sum() == d) {
                count++;
            }
        }
    
        return count;
    }