Swap elements

Report a typo

Suppose you have a numbers array of the IntArray type. Swap its first and last elements. It is guaranteed that the size of the array is larger than 0.

Write a program in Kotlin
fun main() {
val numbers = readLine()!!.split(' ').map { it.toInt() }.toIntArray()
// Do not touch lines above
// Write only exchange actions here.

// Do not touch lines below
println(numbers.joinToString(separator = " "))
}
___

Create a free account to access the full topic