You are viewing a single comment's thread. Return to all comments →
Java Solution:
public static int birthday(List<Integer> s, int d, int m) { int count = 0; for(int index=0; index < s.size() - (m-1); index++){ int sum = s.get(index); for(int i=1; i<m; i++){ int current = s.get(index + i); sum = sum + current; } if(sum == d){ count++; } } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Subarray Division 1
You are viewing a single comment's thread. Return to all comments →
Java Solution: