Reverse first K elements of the given Stack
Given a stack S and an integer K, the task is to reverse the first K elements of the given stack Examples: Input: S = [ 1, 2, 3, 4, 5, 8, 3, 0, 9 ], K = 4Output: [ 4, 3, 2, 1, 5, 8, 3, 0, 9 ]Explanation: First 4 elements of the given stack are reversed Input: S = [ 1, 2, 3, 4, 5, 8, 3, 0, 9 ], K = 7