We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int i = in.nextInt();
int j = in.nextInt();
int k = in.nextInt();
int numOfBeautifulDays=0;
for(int l=i; l<=j;l++) {
if((l-reverse(l))%k ==0) numOfBeautifulDays++;
}
System.out.println(numOfBeautifulDays);
}
public static int reverse(int number){
int reverse = 0;
while(number!=0){
reverse = 10*reverse +number%10;
number = number/10;
}
reverse += number;
return reverse;
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Days at the Movies
You are viewing a single comment's thread. Return to all comments →
public class Solution {
}