O(N) time  and space solution. Simple and Easy to Understand
Track Positions : \n\n- As we scan the string from left to right, we\'ll keep track of the positions of each character in a dictionary called positions.\n\n---\
# Track Positions : \n\n- As we scan the string from left to right, we\'ll keep track of the positions of each character in a dictionary called `positions`.\n\n---\n\n\n# Encounter a Star :\n\n- When we come across a star `*`, we need to identify the smallest character that is currently available.\n- We then change the character at the last recorded position of this smallest character to a star `*`.\n- After making the change, we remove this position from our positions dictionary.\n\n---\n\n\n\n# Clean Up : \n- Once we\'ve processed the entire string, we\'ll remove all star characters `*` from it.\n\n---\n\n\n# Return the Result : \n- The final string, with the rightmost instance of the smallest character removed, is returned.\n\n---\n\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string clearStars(string s) {\n        vector<vector<int>> positions(26);\n\n        for(int i = 0 ; i < s.size() ; i++) {\n            if(s[i] != \'*\') {\n                positions[s[i] - \'a\'].push_back(i);\n            } else {\n                for(int j = 0 ; j < 26 ; j++) {\n                    if(!positions[j].empty()) {\n                        s[positions[j].back()] = \'*\';\n                        positions[j].pop_back();\n                        break;\n                    }\n                }\n            }\n        }\n\n        string result;\n\n        for(int i = 0 ; i < s.size() ; i++) {\n            if(s[i] != \'*\') {\n                result += s[i];\n            }\n        }\n\n        return result;\n    }\n};\n```
['String', 'C++']