You are given a string s and an integer k.
Two characters in s at indices i and j with
As long as there exists at least one pair of close characters, repeatedly perform the following operation:
Find the close pair with the smallest index i. If there is a tie, choose the pair with the smallest index j.
Delete the character at index j from s.
Return the final string after no more operations can be performed.
Constraints:
s.length
k s.length
s consists of lowercase English letters.
You are given a string s and an integer k.
Two characters in s at indices i and j with
As long as there exists at least one pair of close characters, repeatedly perform the following operation:
Find the close pair with the smallest index i. If there is a tie, choose the pair with the smallest index j.
Delete the character at index j from s.
Return the final string after no more operations can be performed.
Constraints:
s.length
k s.length
s consists of lowercase English letters.