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.
func birthday(s: [Int], d: Int, m: Int) -> Int {
// Write your code here
var sum = 0
var result = 0
var j = 0
while j <= s.count - m{
for i in j ... j+m-1{
sum += s[i]
}
if sum == d{
result += 1
}
sum = 0
j += 1
}
return result
}
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 →
func birthday(s: [Int], d: Int, m: Int) -> Int { // Write your code here
}