From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/avg_salary.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 other/avg_salary.cpp (limited to 'other/avg_salary.cpp') diff --git a/other/avg_salary.cpp b/other/avg_salary.cpp deleted file mode 100644 index 12d49ce..0000000 --- a/other/avg_salary.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// 1491. Average Salary Excluding the Minimum and Maximum Salary -#include "leetcode.h" - -/* - * given an array of unique integers 'salary' where 'salary[i]' is the salaray - * of the i'th employee. return the average salary of employees excluding the - * minimum and maximum salary. answer within 10^-5 of actual answer - */ - -class Solution { -public: - double average(vector &salary) { - double max = DBL_MIN, min = DBL_MAX, sum = 0; - for (int i = 0; i < salary.size(); i++) { - sum += salary[i]; - if (salary[i] < min) - min = salary[i]; - if (salary[i] > max) - max = salary[i]; - } - sum = sum - min - max; - return sum / (salary.size() - 2); - } -}; - -int main() { - Solution obj; - vector s1 = {4000, 3000, 1000, 2000}; - vector s2 = {1000, 2000, 3000}; - printf("%f\n", obj.average(s1)); // expect: 2500.00000 - printf("%f\n", obj.average(s2)); // expect: 2000.00000 -} -- cgit v1.2.3