Exercise · Arrays and slices · lesson 10 of 10
Exercise: maximum of arguments
Write a function func maxOf(first int, rest ...int) int that returns the largest of its arguments.
maxOf(3, 9, 4)→9maxOf(7)→7maxOf(-5, -2, -9)→-2
Constraints: there are from one to 1000 arguments, each from -1000000 to 1000000, and all of them may be negative; rest may be empty.
Do not add extra imports unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.