You are viewing a single comment's thread. Return to all 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; }
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division
You are viewing a single comment's thread. Return to all comments →