You are viewing a single comment's thread. Return to all comments →
Java 8 using lambdas
static int beautifulDays(int i, int j, int k) { return (int) IntStream.rangeClosed(i, j) .map(c -> Math.abs(c - reverse(c))) .filter(c -> c % k == 0) .count(); } private static int reverse(int n) { return Integer.parseInt( new StringBuilder(String.valueOf(n)) .reverse().toString()); }
Beautiful Days at the Movies
You are viewing a single comment's thread. Return to all comments →
Java 8 using lambdas