Input: q = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
Output: q = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]
Input: q = [1, 2, 3, 4, 5]
Output: q = [5, 4, 3, 2, 1]
To reverse the queue, we can use a stack data structure that follows the LIFO (Last In, First Out) principle. By storing the elements in such a structure, we can ensure that when the elements are re-inserted into the queue, they will appear in reverse order.