• + 0 comments

    //check the code int reverse_num(int num){ int temp = 0; int neg = num < 0; if (neg) num = -num; while(num){ temp = (temp*10) + (num%10); num /= 10;
    } return neg ? -temp:temp; }

    int beautifulDays(int i, int j, int k) { int beautiful_count = 0;

    for(int day=i; day <= j; day++){
        if(abs(day - reverse_num(day)) % k == 0) {
            beautiful_count++;
        }
    }
    return beautiful_count;
    

    }