You are viewing a single comment's thread. Return to all comments →
Kotlin solution
fun birthday(s: Array<Int>, d: Int, m: Int): Int { var segments= 0 for(i in s.indices){ if(i+m-1 <= s.lastIndex && s.copyOfRange(i,i+m).sum() == d){ segments++ } } return segments }
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 →
Kotlin solution