Definition at line 5 of file main.cpp.
◆ countRangeSum()
| int Solution::countRangeSum |
( |
vector< int > & |
nums, |
|
|
int |
lower, |
|
|
int |
upper |
|
) |
| |
|
inline |
Definition at line 8 of file main.cpp.
9 {
10 int size = (int)nums.size();
11 if (lower > upper || size == 0)
12 return 0;
13
14 int count = 0;
15
16 vector<long long> prefix_sum(size + 1, 0);
17 for (int i = 0; i < size; ++i)
18 prefix_sum[i + 1] = prefix_sum[i] + nums[i];
19
20 for (int el: prefix_sum)
21 cout << "sum: " << el << endl;
22
23 return count;
24 }
Referenced by main().
The documentation for this class was generated from the following file: