File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed
solution/2100-2199/2148.Count Elements With Strictly Smaller and Greater Elements Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -98,10 +98,8 @@ class Solution {
98
98
class Solution {
99
99
public:
100
100
int countElements(vector<int >& nums) {
101
- auto [ mi, mx] = std::ranges::minmax_element(nums);
102
- return std::ranges::count_if(nums, [ mi, mx] (int x) {
103
- return * mi < x && x < * mx;
104
- });
101
+ auto [ mi, mx] = ranges::minmax_element(nums);
102
+ return ranges::count_if(nums, [ mi, mx] (int x) { return * mi < x && x < * mx; });
105
103
}
106
104
};
107
105
```
Original file line number Diff line number Diff line change @@ -96,10 +96,8 @@ class Solution {
96
96
class Solution {
97
97
public:
98
98
int countElements(vector<int >& nums) {
99
- auto [ mi, mx] = std::ranges::minmax_element(nums);
100
- return std::ranges::count_if(nums, [ mi, mx] (int x) {
101
- return * mi < x && x < * mx;
102
- });
99
+ auto [ mi, mx] = ranges::minmax_element(nums);
100
+ return ranges::count_if(nums, [ mi, mx] (int x) { return * mi < x && x < * mx; });
103
101
}
104
102
};
105
103
```
Original file line number Diff line number Diff line change 1
1
class Solution {
2
2
public:
3
3
int countElements (vector<int >& nums) {
4
- auto [mi, mx] = std::ranges::minmax_element (nums);
5
- return std::ranges::count_if (nums, [mi, mx](int x) {
6
- return *mi < x && x < *mx;
7
- });
4
+ auto [mi, mx] = ranges::minmax_element (nums);
5
+ return ranges::count_if (nums, [mi, mx](int x) { return *mi < x && x < *mx; });
8
6
}
9
7
};
You can’t perform that action at this time.
0 commit comments