Find common elements of Stack and Queue
Given a stack of M elements and a queue of N elements in sorted order. The task is to find out the common elements of the stack and the queue. Examples: Input: stack = [1, 3, 5, 7], queue = [1, 2, 5, 9]Output: 5, 1Explanation: 1 and 5 is present in both stack and queue. Input: stack = [1, 3], queue