Leaderboard
Showing:
Handle Score
@Ibrahim Nash 6420
@blackshadows 6380
@mb1973 5646
@Quandray 5233
@akhayrutdinov 5111
@saiujwal13083 4716
@sanjay05 3762
@kirtidee18 3673
@marius_valentin_dragoi 3522
@sushant_a 3459
@verma_ji 3413
Complete Leaderboard
Queue Push & Pop
Basic Accuracy: 63.63% Submissions: 9958 Points: 1

Given an array arr[] of size N, enqueue the elements of the array into a queue and then dequeue them.

Example 1:

Input:
N = 5 
arr[] = 1 2 3 4 5 
Output: 
1 2 3 4 5

Example 2:

Input:
N = 7
arr[] = 1 6 43 1 2 0 5
Output:
1 6 43 1 2 0 5

Your Task:
You don't need to read any input. Your task is to complete the functions push() and _pop(). The function push() takes the array and its size as the input parameters and returns the queue formed, and the function _pop(), takes the queue as the input parameter and prints the elements of the queue.

 

Expected time complexity: O(n)

Expected space complexity: O(n)

 

Constraints:
1 <= Ai <= 107

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Queue Push & Pop

Output Window