17. Queue Operations
My Approach 1
Time Complexity
Code (C++)
class Solution{
public:
void insert(queue<int> &q, int k){
q.push(k);
}
int findFrequency(queue<int> &q, int k){
int sz = q.size();
int c = 0;
while(sz--){
if(q.front() == k)
++c;
q.push(q.front());
q.pop();
}
return c;
}
};My Approach 2
Time Complexity
Code (C++)
Contribution and Support
Last updated