Standard Priority Queue VI
For this problem you use a priority queue to keep track of the indexes to remove later on. Also, the size of the priority queue matters here, need to be minimum otherwise it runs into memory limit exceeded. Keep in mind that the string concatenation also leads to TLE, so need to use a StringBuilder and only convert to string at the return step. Code is down below, cheers, ACC. Lexicographically Minimum String After Removing Stars - LeetCode 3170. Lexicographically Minimum String After Removing Stars Medium 100 6 Add to List Share You are given a string s . It may contain any number of '*' characters. Your task is to remove all '*' characters. While there is a '*' , do the following operation: Delete the leftmost '*' and the smallest non- '*' character to its left . If there are several smallest characters, you can delete any of them. Return the lexicographically smallest resulting string after remov...