You are given a string s and an integer k.
Two identical characters at indices i and j (where i j) are considered close if
While there exists a pair of close characters, merge them by eliminating the character at index j. Repeat this process until no two identical characters are at a distance of at most k.
Return the final string after all possible merges have been made.
Constraints:
s.length
k s.length
s consists of lowercase English letters.
You are given a string s and an integer k.
Two identical characters at indices i and j (where i j) are considered close if
While there exists a pair of close characters, merge them by eliminating the character at index j. Repeat this process until no two identical characters are at a distance of at most k.
Return the final string after all possible merges have been made.
Constraints:
s.length
k s.length
s consists of lowercase English letters.