C++, beats 100% Sliding window
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 
# 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: O(2*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```\n\nclass Solution {\npublic:\n    string shortestBeautifulSubstring(string s, int k) {\n        int n = s.size();\n        int i = 0, j = 0;\n        int cnt = 0;\n        string ans = s + s;  // a string that\'s definitely longer than any possible answer\n        \n        while (j < n) {\n            if (s[j] == \'1\') cnt++;\n            while (i < j && (cnt > k || s[i] != \'1\')) {\n                if (s[i] == \'1\') cnt--;\n                i++;\n            }\n            if (cnt == k && i <= j) {\n                string currentSubstring = s.substr(i, j - i + 1);\n                if (ans.size() > currentSubstring.size() || (ans.size() == currentSubstring.size() && ans > currentSubstring)) {\n                    ans = currentSubstring;\n                }\n            }\n            j++;\n        }\n        \n        return (ans == s + s) ? "" : ans;\n    }\n};\n\n```
['C++']