Subarray Division 1

  • + 1 comment

    c# Solution:

    public static int birthday(List<int> s, int d, int m)
        {
            int possibleCombinations = 0;
            for(int i=0; i<s.Count; i++)
            {
                if((s.Count) - i < m) break;
    
                if(s.GetRange(i, m).Sum(e => e) == d)
                {
                    possibleCombinations++;
                }
            }
            
            return possibleCombinations;
        }