Company: Adobe_4th june_on campus _iit guwahti

Difficulty: medium

Problem Statement

In a good binary string: The number of 0's equals the number of 1's. For every prefix of the string, the number of 1's is greater than or equal to the number of 0's. Optimize a "good" binary string by rearranging its good substrings to create the largest possible numeric value. Rules: A good string can contain multiple good substrings. Two adjacent good substrings can be swapped if the resulting string remains good. Two substrings are adjacent if the last character of the first substring is immediately before the first character of the second substring. Perform zero or more swap operations on adjacent good substrings to form the binary string with the largest possible numeric value and return that value. Example binString = 1010111000 There are two good binary substrings, 1010 and 111000, among others. Swap these two substrings to get a larger value: 1110001010. This is the largest possible good string that can be formed. Function Description Complete the function largestMagical in the

More Adobe_4th june_on campus _iit guwahti OA questionsInterview experiences