• + 0 comments

    Solution in Swift with method Sorted()

    func miniMaxSum(arr: [Int]) -> Void {
        // Write your code here
        var sorted = arr.sorted()
        var min = 0
        var max = 0
        
        for i in 0...3 {
            min = min + sorted[i]
        }
        
        for i in 1...4 {
            max = max + sorted[i]
        }
        
        print(min, max)    
        // Printear el min y max de 5 enteros
    }