Skip to content

Commit

Permalink
Q1491 added.
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Mar 6, 2023
1 parent 58d3a88 commit 995d951
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions E_1491_AverageSalaryExcludingtheMinimumandMaximumSalary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Solution {
public double average(int[] salary) {
int max=0;
int min=10000000;
double sum=0;
for (int i=0; i<salary.length;i++){
sum+=salary[i];
if(salary[i]>max)
max=salary[i];
if(salary[i]<min)
min=salary[i];
}
sum=sum-(min+max);
return sum/(salary.length-2);

}
}

0 comments on commit 995d951

Please sign in to comment.