Best solution so far without heap
Intuition: Use Freq array from 26 - 1, if freq > limit then simply grab one next char and come back to prev charComplexity
Time complexity: O(n * Min(freq, limi
# Intuition: Use Freq array from 26 - 1, if freq > limit then simply grab one next char and come back to prev char\n\n\n# Complexity\n- Time complexity: O(n * Min(freq, limit))\n- Space complexity: O(n)\n\n# Code\n```csharp []\npublic class Solution {\n    public string RepeatLimitedString(string s, int repeatLimit) {\n        int[] freq = new int[26];\n        for(int i=0; i<s.Length; i++)\n        {\n            freq[s[i] - \'a\']++;\n        }\n        StringBuilder sb = new();\n        for(int i=25; i>=0; i--)\n        {\n            int pos = i;\n            int limit = Math.Min(freq[pos], repeatLimit);\n            for(int j=0; j<limit; j++)\n            {\n                sb.Append((char)((pos) + \'a\'));\n                freq[pos]--;\n            }\n            if(freq[pos] >= 1)\n            {                \n                pos--;\n                while (pos >= 0 && freq[pos] == 0) \n                {\n                    pos--;\n                }\n                if (pos < 0) break; \n                sb.Append((char)((pos) + \'a\'));\n                freq[pos]--;\n                i++;\n            }\n        }\n        return sb.ToString();\n    }\n}\n```
['Iterator', 'C#']