• + 0 comments

    Here is my Python solution! We check all the days and if the absolute value between the day and the reversed day is divisible by k, we add 1 to the amount of beautiful days.

    def beautifulDays(i, j, k):
        beautiful = 0
        for day in range(i, j + 1):
            if abs(day - int("".join(list(reversed(str(day)))))) % k == 0:
                beautiful += 1
        return beautiful