Contest Video Solution | Explanation with Drawings | In Depth | C++
Intuition, approach, and complexity discussed in detail in video solution.\nhttps://youtu.be/TgPJDoO-z3M\n\n\n# Code\n\nclass Solution {\npublic:\n    string sh
# Intuition, approach, and complexity discussed in detail in video solution.\nhttps://youtu.be/TgPJDoO-z3M\n\n\n# Code\n```\nclass Solution {\npublic:\n    string shortestBeautifulSubstring(string s, int k) {\n        int left = 0, right = 0, sz = s.size();\n        \n        vector<string> subStrings;\n        int currCnt = 0;\n        /\n        for(int indx = 0; indx < sz ; indx++){\n            for(int indx1 = indx; indx1 < sz; indx1++){\n                subStrings.push_back(s.substr(indx, indx1 - indx + 1));\n            }\n        }\n        \n        vector<string> res;\n        for(auto & str : subStrings){\n            int cnt = count(str.begin(), str.end(), \'1\');\n            if(cnt == k){\n                res.push_back(str);\n            }\n        }\n        \n        sort(res.begin(), res.end(), [](const string & str1, const string & str2)->bool{\n            if(str1.size() != str2.size())return str1.size() < str2.size();\n            else return str1 < str2;\n        });\n        if(res.size())\n            return res[0];\n        else\n            return "";\n    }\n};\n```
['C++']