Company: ubs_29july
Difficulty: medium
Get Maximum Ones Problem Description Implement a function that finds the maximum possible number of '1's in the string s after performing at most k operations. In one operation: Choose an index i (where 0 <= i < length of s - 1 ) and update the character at position i as follows: s[i] = max(s[i], s[i] + 1) . This means if s[i] is '0', it becomes '1'. If s[i] is '1', it remains '1'. The function getMaximumOnes will take two inputs: string s : the string int k : the maximum number of operations allowed The function should return an integer representing the maximum possible number of '1's in the string s . Examples Example 1: Input: s = "10110", k = 1 Output: 4 Explanation: An optimal sequence of at most k operations: Operation Number s before Chosen Index (0-based) s after 1 10110 Choose the index i = 1 11110 The final string "11110" has 4 ones. Example 2: Input: s = "00011", k = 2 Output: 4 Explanation: An optimal sequence of at most k operations: Operation Number s before Chosen