• + 0 comments

    Here is my Python solution! I think it can probably be done much faster, but I was too lazy to try to create a more efficient solution.

    def workbook(n, k, arr):
        special = 0
        current = 1
        sub = 0
        for chapter in range(len(arr)):
            for problem in range(arr[chapter]):
                if sub == k:
                    current += 1
                    sub = 0
                if problem + 1 == current:
                    special += 1
                sub += 1
            if sub != 0:
                current += 1
                sub = 0
        return special