You are viewing a single comment's thread. Return to all comments →
**SOLUTION IN JAVA 8: **
public static int birthday(List<Integer> s, int d, int m) { ArrayList<Integer> list=(ArrayList<Integer>) s; int count=0; for(int i=0; i<=list.size()-m; i++) { int sum=0; for(int j=i; j<i+m; j++) { sum=sum+list.get(j); } if(sum==d) { count++; } } 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 →
**SOLUTION IN JAVA 8: **