Skip to main content

Practice ยท 4 of 4

Max with a constraint

CHALLENGE
Difficulty: beginner+25 XP

Implement static T MaxOf<T>(IEnumerable<T> items) where T : IComparable<T> returning the largest element; throws InvalidOperationException for null or empty input.

Back to lesson: Practice: Generics workout