Skip to content

Commit 8c32945

Browse files
committed
update
1 parent ef8e20b commit 8c32945

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
struct MyQ{
2-
deque<int> D,Min;
3-
void push(int val){
4-
D.push_back(val);
5-
while(!Min.empty() && Min.back()>val) Min.pop_back();
6-
Min.push_back(val);
2+
deque<int> D, Min;
3+
4+
void push( int val ) {
5+
D.push_back( val );
6+
while( !Min.empty() && Min.back() > val ) Min.pop_back();
7+
Min.push_back( val );
78
}
8-
void pop(){
9-
if(Min.front()==D.front() )
9+
10+
void pop() {
11+
if( Min.front() == D.front() )
1012
Min.pop_front();
1113
D.pop_front();
1214
}
13-
int get(){
15+
16+
int get() {
1417
return Min.front();
1518
}
1619
};

0 commit comments

Comments
 (0)