You are viewing a single comment's thread. Return to all comments →
In C#
class Result { public static int birthday(List<int> s, int d, int m) { int count=0; for(var i=0; i<s.Count; i++) { var temp =SegmentSum(s, i, m); if(temp==d) count++; } return count; } public static int SegmentSum(List<int> s, int index, int room) { var sum =0; var iterUpto = index + room; for(var i=index; i<iterUpto; i++ ) { if(i>=s.Count) break; sum+=s[i]; } return sum; } }
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 →
In C#