Skip to content

Commit fee4e10

Browse files
authored
Create solution.cpp
1 parent d2bc1fa commit fee4e10

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

queues_reversal/solution.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
queue<int> rev(queue<int> q)
2+
{
3+
stack<int>s;
4+
while(!q.empty()){
5+
s.push(q.front());
6+
q.pop();
7+
8+
}
9+
while(!s.empty()){
10+
q.push(s.top());
11+
s.pop();
12+
} // add code here.
13+
return q;
14+
15+
}

0 commit comments

Comments
 (0)