Easy JAVA solution || beats 100% 🔥🔥🔥
Complexity\n- Time complexity:\nO(nlogn) for sort and O(n/2) for main logic\n\n- Space complexity:\nConstant O(1) \n\n# Code\n\nclass Solution {\n    public dou
# Complexity\n- Time complexity:\nO(nlogn) for sort and O(n/2) for main logic\n\n- Space complexity:\nConstant O(1) \n\n# Code\n```\nclass Solution {\n    public double minimumAverage(int[] nums) {\n        Arrays.sort(nums);\n        int s=0,e=nums.length-1;\n        double ans=(nums[s]+nums[e])/2.0;\n        \n        while(s<=e){\n            System.out.println(ans);\n            ans=Math.min(ans,((nums[s]+nums[e])/2.0));\n            s++;\n            e--;\n        }\n        return ans;\n    }\n}\n```
['Java']