L
Size: a a a
L
L
PE
IP
L
IP
IP
L
f: Int => Boolean
, an integer n is called a “3-f” if there are only three different integers j ∈ [1, ..., n] such that f(j) returns true. AM
U
IP
PE
IP
IP
U
IP
IP
IP
L
IP
fun solution(f: (Int) -> Boolean) = (1..1000).filter { n -> (1..n).count { j -> f(j) } == 3 }