Sort by

recency

|

1747 Discussions

|

  • + 0 comments

    Simple Java Solution

    class Result {
    
        /*
         * Complete the 'beautifulDays' function below.
         *
         * The function is expected to return an INTEGER.
         * The function accepts following parameters:
         *  1. INTEGER i
         *  2. INTEGER j
         *  3. INTEGER k
         */
        
        public static int beautifulDays(int i, int j, int k) {
        // Write your code here
        int total = 0;
        for(;i<=j; i++)
        {
            int temp = i;
            int rev = 0;
    				
            while(temp != 0)
            {
                int lst = temp%10;
                temp = temp / 10;
                rev = rev * 10 + lst;
            }
            int diff = Math.abs(i - rev);
            if(diff % k == 0)
            {
                total++;
            }
        }
        return total;
        }
    
    }
    
  • + 0 comments

    "Beautiful Days at the Movies" reminds me of the excitement and anticipation for the upcoming Geometry Dash 2.2 APK! Just like a great movie captivates its audience, the new update promises thrilling features, fresh levels, and cinematic gameplay moments. Have you been keeping an eye on what’s coming in 2.2?

  • + 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
    
  • + 0 comments

    Hi There!!!!

    Beautiful days at the movies are a perfect way to unwind, and Lily’s game adds a fun twist to deciding which day to go. By finding days where the difference between the day’s number and its reverse is evenly divisible by a given number, she marks those as beautiful days. This thoughtful approach makes each movie experience feel special and well-timed. For anyone looking to make their movie days even more enjoyable, explore for a seamless and captivating movie-watching experience. All the best!

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/6rYwcW6BYH4

    int beautifulDays(int i, int j, int k) {
        int ans = 0;
        for(int el = i; el <= j; el++){
            string s = to_string(el);
            reverse(s.begin(), s.end());
            if(abs(stoi(s) -el ) % k == 0) ans++;
        }
        return ans;
    }