We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50bfe34 commit 13c57fdCopy full SHA for 13c57fd
1619_Mean_of_Array_After_Removing_Some_Elements.cpp
@@ -0,0 +1,11 @@
1
+class Solution {
2
+public:
3
+ double trimMean(vector<int>& arr) {
4
+ double sum = 0.0;
5
+ int size = arr.size(), i = size*0.05, j = size-i-1;
6
+ sort(arr.begin(), arr.end());
7
+ while(i<j)
8
+ sum+=arr[i++]+arr[j--];
9
+ return sum/(size - size*0.1);
10
+ }
11
+};
0 commit comments