Posts

Showing posts from June, 2018

Algorithm-1

Hello everyone. I have taken this question from hackerrank and posted solution for it. And hope that it will be helpful for you. Problem Tittle :- Beautiful days at movies Description:- Lily likes to play games with integers. She has created a new game where she determines the difference between a number and its reverse. For instance, given the number 12 , its reverse is 21 Their difference is 9 . The number is 120 ,reversed is 21 , and their difference is 99 . She decides to apply her game to decision making. She will look at a numbered range of days and will only go to a movie on a beautiful day. 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. Input Format:- A single line of three space-separated inte