Ad
  • Default User Avatar

    Hi, we are filling the elements of arr with 1's.

    In arr[a:b+1]=[1]*(b-a+1) , (b-a+1) is the number of times [1] will be filled in arr within the range [a:b+1] (which orginally contained 0's).
    So, even if a day is repeated, the function will count it one time only as it is summing the elements of arr and for a particular day(index of arr), 1 can be filled/counted once only.

    Hope it helps (:

    Regards