![]() |
VOOZH | about |
Given a deque dq containing integer elements, the task is to traverse the dq and print its elements of it.
Examples:
Input: dq = [1, 2, 3, 4, 5]
Output: 1 2 3 4 5
Explanation: We print elements of deque from from front to backInput: dq = [1]
Output: 1
Deque Traversal refers to the process of accessing each element of the deque, typically to read or process the values stored within.
1 2 3 4 5
Time Complexity: O(n)
Auxiliary Space: O(1)