• + 0 comments

    Golang

    func birthday(s []int32, d int32, m int32) int32 {
        
        count :=0
        
        for i := 0; i< len(s); i++ {
            sum :=0
         for j:=i; j< int(m)+i; j++{
             if j >= len(s){
                 break
             }
             sum += int(s[j])
         }   
         if sum == int(d){
             count ++
         }
        }
              
        return int32(count)
    
    }