Skip to content

Commit 23c2fd9

Browse files
authored
Update max-stack.cpp
1 parent 574ce14 commit 23c2fd9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

C++/max-stack.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class MaxStack {
1919
}
2020

2121
int pop() {
22-
const auto& it = idx_to_val_.begin();
23-
const auto val = it->second;
22+
const auto val = idx_to_val_.begin()->second;
2423
remove(val);
2524
return val;
2625
}
@@ -34,8 +33,7 @@ class MaxStack {
3433
}
3534

3635
int popMax() {
37-
const auto& it = val_to_idxs_.begin();
38-
const auto val = it->first;
36+
const auto val = val_to_idxs_.begin()->first;
3937
remove(val);
4038
return val;
4139
}

0 commit comments

Comments
 (0)