• + 0 comments
        public static int birthday(List<Integer> s, int d, int m) {
            int count = 0;
            for(int i = 0; i < s.size()-m+1; i++) {
                
                int j = 0;
                int sum = 0;
                while(j < m) {
                    sum = sum + s.get(j+i);
                    if (sum > d) {
                        break;
                    } else if (sum == d && j == m - 1) {
                        count++;
                    }
                    j++;
                }
            }
            return count;
        }