[Solution] Another String Minimization Problem Codeforces Solution
You have a sequence of length , consisting of integers between and . You also have a string , consisting of characters B.
You are going to perform the following operations.
- At the -th () operation, you replace either the -th or the -th character of with A. You can replace the character at any position multiple times through the operations.
Find the lexicographically smallest string you can get after these operations.
A string is lexicographically smaller than a string of the same length if and only if in the first
Solution Click Below:- 👉CLICK HERE
position where and differ, the string has a letter that appears earlier in the alphabet than the corresponding letter in .
The first line contains the number of test cases ().
Another String Minimization Problem Codeforces Solution
Making Towers Codeforces Solution
Qpwoeirut And The City Codeforces Solution
Chopping Carrots (Easy Version) Codeforces Solution
Chopping Carrots (Hard Version) Codeforces Solution
The first line of each test case contains two integers and () — the length of the sequence and the length of the string respectively.
The second line contains integers () — the sequence .
For each test case, print a string of length — the lexicographically smallest string you can get. Each character of the string should be either capital English letter A or capital English letter B.
No comments:
Post a Comment