Untitled

 avatar
unknown
plain_text
2 years ago
198 B
4
Indexable
void rev(queue<int> &q){
    if(q.empty()) return;
    int a=q.front();
    q.pop();
    rev(q);
    q.push(a);
}

queue<int> reverseQueue(queue<int> q)
{
    rev(q);
    return q;

}
Editor is loading...