You are viewing a single comment's thread. Return to all comments →
let sortedArray = arr.sorted(by: <) var maximumCount = 0 var minimumCount = 0 for value in sortedArray.dropFirst(1) { maximumCount += value } for value in sortedArray.dropLast(1){ minimumCount += value } print("\(minimumCount) \(maximumCount)")
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 →