Company: Teradata
Difficulty: medium
Lexicographically Smallest String Problem Description Given a string s of length N that consists of lowercase Latin letters. Each lowercase Latin letter ("a"-"z") is colored with either black or white. You can perform the following operation any number of times (possibly, zero) on the string: You can swap any two adjacent characters of the string s if the letters that you are swapping are colored differently. Find the lexicographically smallest possible string s after applying any number of operations (possibly, zero). Notes A string a is lexicographically smaller than a string b if and only if one of the following holds: a is a prefix of b but a ≠ b In the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b . Assume 1-based indexing. Function description Complete the Lexicographically_Smallest_String function. This function takes the following 3 parameters and returns the lexicographically smallest poss