Challenge 2: A reified Type Check Function — Solution inline fun countOfType(list: List): Int { return list.count { it is T } } fun main() { val mixed: List = listOf(1, "hello", 2.5, "world", 3, 4.0, "kotlin") println("Ints: ${countOfType(mixed)}") println("Strings: ${countOfType(mixed)}") println("Doubles: ${countOfType(mixed)}") } /* Output: Ints: 2 Strings: 3 Doubles: 2 Notes: - countOfType must be both "inline" and use "reified T" together — reified only works on inline functions, since the compiler needs to paste the function body into each call site to know the real type. - "it is T" would be a compile error in a normal (non-reified) generic function, because T would be erased at runtime and unavailable to check against — reified is exactly what makes this check legal. - Each call (countOfType(mixed), countOfType(mixed), etc.) substitutes a different concrete type for T at compile time. */