• + 0 comments

    Kotlin answer to match all tests

    fun miniMaxSum(arr: Array<Int>): Unit {
        val sorted = arr.map { it.toLong() }.sorted()
        val min:Long = (sorted.take(4).sum()).toLong()
        val max:Long = (sorted.takeLast(4).sum()).toLong()
    
        println("$min $max")
    }