Advertisement
sajid161

12:3

Jan 9th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. queue<int> rev(queue<int> q)
  2. {
  3.    stack<int> st;
  4.  
  5.    while(!q.empty())
  6.    {
  7.        st.push(q.front());
  8.        q.pop();
  9.    }
  10.    while(!st.empty())
  11.    {
  12.        q.push(st.top());
  13.        st.pop();
  14.    }
  15.    return q;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement