You are viewing a single comment's thread. Return to all comments →
fun miniMaxSum(arr: Array<Int>) { var min = arr[0] var max = arr[0] var sum: Long = 0 arr.forEach { if (it > max) { max = it } if (it < min) { min = it } sum += it } println("${sum - max} ${sum - min}") }
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →