Playing with numbers

Report a typo

You have a mutable list of integers numbers. Add the sum of all list elements to the beginning of the list. Then delete the penultimate item in the list. It is guaranteed that the length of the array is greater than 2.

Sample Input 1:

8 11 1 2 3

Sample Output 1:

25 8 11 1 3
Write a program in Kotlin
fun main() {
val numbers = readLine()!!.split(' ').map { it.toInt() }.toMutableList()
// do not touch the lines above
// write your code here

// do not touch the lines below
println(numbers.joinToString(" "))
}
___

Create a free account to access the full topic