We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 52bb7b2 commit 5ce997fCopy full SHA for 5ce997f
C++/delete-and-earn.cpp
@@ -4,15 +4,15 @@
4
class Solution {
5
public:
6
int deleteAndEarn(vector<int>& nums) {
7
- vector<int> values(10001);
+ vector<int> vals(10001);
8
for (const auto& num : nums) {
9
- values[num] += num;
+ vals[num] += num;
10
}
11
- int val_i = values[0], val_i_1 = 0, val_i_2 = 0;
12
- for (int i = 1; i < values.size(); ++i) {
+ int val_i = vals[0], val_i_1 = 0, val_i_2 = 0;
+ for (int i = 1; i < vals.size(); ++i) {
13
val_i_2 = val_i_1;
14
val_i_1 = val_i;
15
- val_i = max(values[i] + val_i_2, val_i_1);
+ val_i = max(vals[i] + val_i_2, val_i_1);
16
17
return val_i;
18
0 commit comments