You are viewing a single comment's thread. Return to all comments →
public static int beautifulDays(int i, int j, int k) { int count = 0; for (int day = i; day <= j; day++) { if (Math.abs(day - reverse(day)) % k == 0) count++; } return count; }
static int reverse(int n) { StringBuilder sb = new StringBuilder(String.valueOf(n)); return Integer.parseInt(sb.reverse().toString()); }
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 →