Implement Queue using Arrays
Difficulty: Basic
Acceptance: %
Points: 10.00
Implement a Queue using an array to handle the following types of queries:
- Push operation (1 x): This query adds the element x to the queue.
- Pop operation (2): This query removes and returns the front element from the queue. If the queue is empty, return -1.
You need to implement the push and pop functions. The rest of the program will handle the input and output operations.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints: - 1 <= number of query<= 10^5
- 0 <= x <= 10^5
Companies: Amazon Goldman Sachs
Please log in to access the Submissions tab, where you can review your progress and explore code submissions from other participants.
Please log in to access the Solution tab and view detailed answers and explanations.
Please log in to access the Discussion tab and join conversations with other participants.