leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE |

commit70acc1c9831498cf6d4b2884b4ee8d864c299b8c
parent11516e28020baf08caeb9f312c286adaf0cfeb68
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateMon, 1 May 2023 17:29:19 +0200

Daily Problem

Diffstat:
AProblems/1491.cpp|++++++++++++
MREADME.md|+

2 files changed, 13 insertions(+), 0 deletions(-)


diff --git a/Problems/1491.cpp b/Problems/1491.cpp

@@ -0,0 +1,12 @@

class Solution {
public:
double average(vector<int> &salary) {
int mini = *min_element(salary.begin(), salary.end());
int maxi = *max_element(salary.begin(), salary.end());
int sum = 0, count = 0;
for (int i = 0; i < salary.size(); i++)
if (salary[i] != mini && salary[i] != maxi) sum += salary[i], count++;
return (double)sum / count;
}
};

diff --git a/README.md b/README.md

@@ -448,6 +448,7 @@ for solving problems.

| 1472 | Medium | [Design Browser History ](Problems/1472.cpp) |
| 1480 | Easy | [Running Sum of 1d Array](Problems/1480.cpp) |
| 1489 | Hard | [Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree](Problems/1489.cpp) |
| 1491 | Easy | [Average Salary Excluding the Minimum and Maximum Salary](Problems/1491.cpp) |
| 1514 | Medium | [Path with Maximum Probability](Problems/1514.cpp) |
| 1519 | Medium | [Number of Nodes in the Sub-Tree With the Same Label](Problems/1519.cpp) |
| 1523 | Easy | [Count Odd Numbers in an Interval Range](Problems/1523.cpp) |