Company: Aveva_24oct
Difficulty: medium
Task 1 Problem Description You are given a string named digits made of digits '1' and/or '2'. It represents a positive integer. Remove zero or more digits from it, so that each remaining digit occurs an even number of times and the value of the resulting integer is as large as possible. Write a function: string solution(string &digits); that, given a string named digits of length N, representing the integer, returns a string representing the largest obtainable integer after performing the removals. Examples Example 1: Input: digits = "121212" Output: "2121" Example 2: Input: digits = "2121122" Output: "221122" Example 3: Input: digits = "1111" Output: "1111" Constraints Write an efficient algorithm for the following assumptions: N is an integer within the range [3..200,000] ; string digits is made only of the characters '1' and/or '2'.