Count Elements With Strictly Smaller and Greater Elements LeetCode solution in C++
1class Solution {2public:3int countElements(vector<int> &nums) {4int M = *max_element(nums.begin(), nums.end());5int m = *min_element(nums.begin(), nums.end());6int res = 0;7for (int i = 0; i < nums.size(); i++) {8if (nums[i] > m && nums[i] < M) res++;9}10return res;11}12};