Two pointer approach (barely passed TCs and surpassed no one :) *fire emojis* 
Intuition and ApproachSorted string in lexicographically largest way to bring bigger chars ahead and together,
Two pointers i and j used, i is current index whi
# Intuition and Approach\nSorted string in lexicographically largest way to bring bigger chars ahead and together,\nTwo pointers `i` and `j` used, `i` is current index while `j` is index of next different character that is ready to get swapped.\nIdea is to iterate till we cross `repeatLimit` then swap `s[i]` and `s[j]` if there are more characters equal to initial `s[i]`.\n\nAfter doing this we check and append only those characters that do not cross `repeatLimit` as in question says there is no need to include every character from string `s`.\n\n# Complexity\n- Time complexity:\n$$O(n logn)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    string repeatLimitedString(string s, int repeatLimit) {\n        sort(s.rbegin(), s.rend());\n        int i=0,j=0, n=s.size();\n\n        while(j<n){\n            while(j<n && s[i]==s[j]) j++;\n            \n            while(i<n && j<n && s[i]!=s[j])\n            {\n                char c = s[i];\n                int len=1;\n                while(i<n && len <= repeatLimit && s[i]==c){\n                    len++;\n                    i++;\n                }\n                if(s[i]==c) {\n                    swap(s[i],s[j]);\n                    i++;\n                    j++;\n                }\n            }\n        }\n\n        // checking and appending only valid chars\n\n        string out = "";\n        out += s[0];\n        int len=1;\n        for(int i=1;i<n;i++){\n            if(s[i]==s[i-1]) len++;\n            else len=1;\n            if(len<=repeatLimit) out += s[i];\n        }\n        \n        return out;\n    }\n};\n```\n\n`EDIT- corrected time complexity`
['Two Pointers', 'Sorting', 'C++']