Subarray Division 2

  • + 0 comments

    Kotlin version

    fun birthday(s: Array<Int>, d: Int, m: Int): Int {
        return s.toList()
        .windowed(size = m, step = 1)
        .filter { it.sum() == d }.size
    }