Company: Axis_bank_22nov
Difficulty: medium
Last One Standing Problem Description You are given an alphanumeric string S and an integer K. Consider a new string in which S is appended K-1 times (effectively expanding the string to repeat S a total of K times). Now, in this new string, the following operations are performed: 1. Every alternate character starting from the first character is removed. 2. Every alternate character starting from the last character is removed. The above two operations are repeated until one character remains. Your task is to find and return a string representing the last remaining character after performing all the operations. Note: Here, alphanumeric refers to the string that may contain alphabets (a-z and A-Z), numerals (0-9), and certain special characters such as '$', '#', '&', and '*'. Examples Example 1: Input: S = "abcd", K = 3 Output: "b" Explanation: The following operations can be performed on the string "abcd": - S = abcdabcdabcd (The string obtained after appending the given string K-1 time