Simple Swift Solution (+ Heap)
CodeCode
![Screenshot 2025-04-02 at 3.14.02 PM.png](https://assets.leetcode.com/users/images/e72b9617-99f9-45d6-ac95-488f35afd4f8_1743596116.6023881.png)


# Code
```swift []
class Solution {
    func minimumAverage(_ nums: [Int]) -> Double {
        var nums = Heap(nums), avr = Heap<Double>()
        while nums.count > 0 {
            avr.insert(Double(nums.popMax()! + nums.popMin()!) / 2.0)
        }
        return avr.popMin()!
    }
}
```

![Screenshot 2025-04-02 at 3.31.12 PM.png](https://assets.leetcode.com/users/images/48b32345-be1a-4fba-a80b-9a4c7d2378bc_1743597102.480907.png)

# Code
```swift []
class Solution {
    func minimumAverage(_ nums: [Int]) -> Double {
        var nums = nums.sorted(), left = 0, right = nums.count - 1, minAvr = 50.0
        while left < right {
            minAvr = min(minAvr, Double(nums[left] + nums[right]) / 2.0)
            left += 1
            right -= 1
        }
        return minAvr
    }
}
```
['Array', 'Two Pointers', 'Swift', 'Sorting']