Lexicographically Minimum String After Removing Star
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```golang []\nfunc clearStars(s string) string {\n    chIdx := make([][]int, 26)\n    minCh := 0\n    bytes := []byte(s)\n    \n    for i, v := range(bytes) {\n        if v != \'*\' {\n            chIdx[v - \'a\'] = append(chIdx[v - \'a\'], i)\n            if minCh > int(v - \'a\') {\n                minCh = int(v - \'a\')\n            }\n        } else {\n            for minCh < 26 {\n                if n := len(chIdx[minCh]); n > 0 {\n                    minIndex := chIdx[minCh][n - 1]\n                    chIdx[minCh] = chIdx[minCh][:n - 1]\n                    bytes[minIndex] = \'*\'\n                    break\n                }\n                minCh++\n            }\n        }\n    }\n\n    var builder strings.Builder\n    for _, v := range(bytes) {\n        if v != \'*\' {\n            builder.WriteByte(v)\n        }\n    }\n    return builder.String()\n}\n```
['Go']