Challenge 1: A Generic Constrained Function — Solution fun > middle(a: T, b: T, c: T): T { return when { (a >= b && a <= c) || (a <= b && a >= c) -> a (b >= a && b <= c) || (b <= a && b >= c) -> b else -> c } } fun main() { println(middle(5, 1, 9)) println(middle("banana", "apple", "cherry")) } /* Output: 5 banana Notes: - > restricts T to any type that supports comparison (>=, <=), which is what makes the "is a between b and c" checks valid inside the function body. - middle(5, 1, 9): 5 sits between 1 and 9, so it's the middle value. - middle("banana", "apple", "cherry"): alphabetically apple < banana < cherry, so "banana" is the middle value. - The same function works for both Int and String (and any other Comparable type) without any changes, because it's generic. */