We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
static int birthday(List<int> s, int d, int m) {
return Enumerable.Range(0, s.Count - m + 1)
.Select(x => s.Skip(x).Take(m).Sum())
.Count(x => x == d);
}
but this is not optimal solution performance vice - it do too much redundant sum calculations (see discussion above for details)
Cookie support is required to access HackerRank
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 →
It could be simplified even more