Given a range of numbered days, [i..j] and a number k, determine the number of days in the range that are beautiful. Beautiful numbers are defined as numbers where | i - reverse(i) | is evenly divisible by k. If a day's value is a beautiful number, it is a beautiful day. Print the number of beautiful days in the range...
Complete the beautifulDays function in the editor below. It must return the number of beautiful days in the range...
See the full description of the problem Beautiful Days at the Movies
Simple brute-force is enough to solve this problem. Run a loop from i to j and for each number x check if abs(x - reverseOfX) % k === 0; if it does it's a Beautiful day
Time complexity: O(n) //Iterate over each test case
Space complexity: O(1)