Search
 
SCRIPT & CODE EXAMPLE
 

CPP

1491. Average Salary Excluding the Minimum and Maximum Salary leetcode solution in c++

class Solution {
public:
    double average(vector<int>& salary) {
        double res;
        int n=salary.size(),sum=0;
        sort(salary.begin(),salary.end());
        for(int i=0;i<salary.size();i++)
        {
            sum+=salary[i];
        }
        res = sum - (salary[0] + salary[n-1]);
        res/=(n-2);
        return res;
    }
};
Comment

PREVIOUS NEXT
Code Example
Cpp :: Hiring Test codechef solution in c++ 
Cpp :: time optimisation c++ 
Cpp :: c++ hsl to rgb integer 
Cpp :: the partition function of a system is given by z= 1/(1-e^-bEi), calculate the total energy of the system 
Cpp :: left recursion program in c++ 
Cpp :: for in c++ example 
Cpp :: how to fixed how many digit will be after point in c++ 
Cpp :: ue4 log 
Cpp :: Arduino Access Point ESP8266 
Cpp :: dignità 
Cpp :: flutter websocket auto reconnect 
Cpp :: font family slick 
Cpp :: c++ multiplication table rows and columns 
Cpp :: The elements are store at contiguous memory locations in C++ 
Cpp :: patterns in c++ 
Cpp :: reference variablesr in c++ 
Cpp :: opencv read gif c++ 
Cpp :: c++ cout 
Cpp :: 18 in 12 hour time 
Cpp :: Set Specific Time in youtube Video url 
Cpp :: assignment operators 
Cpp :: run with cpp version 
Cpp :: no match for ‘operator=’ (operand types are ‘std::basic_ostream’ and ‘int’) 
C :: how to use gotoxy in c language 
C :: docker container give usb access 
C :: c program to find area of circle 
C :: data types in c 
C :: arduino client disconnect 
C :: scan numbers into array c 
C :: c define array size 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =