Simple C++ Solution || 100% faster ||
\n\nclass Solution {\n    \npublic:\n    \n    string smallestSubsequence(string s) {\n       \n        vector<int> cand(256, 0);\n        vector<bool> visited(
```\n\nclass Solution {\n    \npublic:\n    \n    string smallestSubsequence(string s) {\n       \n        vector<int> cand(256, 0);\n        vector<bool> visited(256, false);\n\n        for(auto&k:s)\n            cand[k]++ ;\n        \n        string res = "0" ;\n            \n        for(auto&k:s)\n        {\n            cand[k]-- ;\n            if(visited[k])\n                continue ;\n            while( k < res.back() && cand[res.back()] )\n            {\n                visited[res.back()] = false ;\n                res.pop_back() ;\n            }\n            res+=k ;\n            visited[k] = true ;\n        }\n        \n        return res.substr(1) ;\n    }\n    \n};\n```
['C', 'C++']