You are viewing a single comment's thread. Return to all comments →
public static int birthday(List<int> s, int d, int m) { int counter = 0; for (var i = 0; i < s.Count; i++) { var temp = 0; var ctr = 0; for (var j = i; j < s.Count; j++) { ctr++; temp += s[j]; if (ctr == m && temp == d) counter++; if (ctr == m && temp != d) break; } } return counter; }
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 →