• Above Amit Lohia says:

    For example, if there is a holiday between the dtEndDate from step 2 and dtEndDate from step 3

    This is the correct diagnosis of the flaw. But the solution is only of a recursive type and thus implies a loop.

    Let's say you fix this one. You found 10 holidays between the two end dates and add 10.

    But holidays may be again found between these two end dates and you have to start all over again in fixing things.

    When you have finally reached the part of the loop where there are no more holidays between the two end dates you are finally done. But you needed a loop to get there.