[C++] | | Easy | | Count - Min Size - Sorting
\n\n# Code\n\nclass Solution {\npublic:\n    string shortestBeautifulSubstring(string s, int k) {\n      int n=s.size(),cnt=0,temp=INT_MAX;\n      string s1="";
\n\n# Code\n```\nclass Solution {\npublic:\n    string shortestBeautifulSubstring(string s, int k) {\n      int n=s.size(),cnt=0,temp=INT_MAX;\n      string s1="";\n        vector<string> v;\n        for(int i=0;i<n;i++){\n            string s2="";\n            for(int j=i;j<n;j++){\n                if(s[j]==\'1\'){\n                    cnt++;\n                }\n                if(cnt<=k){\n                 s2+=s[j];   \n                }\n                if(cnt==k){\n                    v.push_back(s2);\n                    int n1=s2.size();\n                    temp=min(temp,n1);\n                }\n            }\n            cnt=0;\n        }\n        sort(v.begin(),v.end());\n        for(int i=0;i<v.size();i++){\n                if(v[i].size()==temp){\n                    s1+=v[i];\n                    break;\n                }\n            }\n            return s1;\n        \n    }\n};\n```
['Sliding Window', 'Sorting', 'C++']