Simple Sliding Window Approach || C++ || Easy-Solution
\nclass Solution {\nprivate:\n    string helpme_compare(string a, string b)\n    {\n        if (a.size() < b.size())   return a;\n        if (b.size() < a.size(
```\nclass Solution {\nprivate:\n    string helpme_compare(string a, string b)\n    {\n        if (a.size() < b.size())   return a;\n        if (b.size() < a.size())   return b;\n        \n        int ind = 0;\n        while(ind < a.size())\n        {\n            int valA = a[ind] - \'0\';\n            int valB = b[ind] - \'0\';\n            if (valB < valA)   return b;\n            if (valA < valB)   return a;\n            ind += 1;\n        }\n        return a;\n    }\npublic:\n    string shortestBeautifulSubstring(string s, int k) \n    {\n        int ws = 0 , we = 0;\n        string ans = "" ;\n        string temp = "";\n        bool once = false;\n        int count = 0;\n        \n        while(we < s.size())\n        {\n            temp += s[we];\n            if (s[we] == \'1\')   count += 1;\n            \n            if (count == k)\n            {\n                if (once == false)\n                {\n                    ans = temp;\n                    once = true;\n                }\n                else\n                {\n                    ans = helpme_compare(ans,temp);\n                }\n                \n                while(count == k)\n                {\n                    if (count == k)\n                    {\n                        ans = helpme_compare(ans,temp);\n                    }\n                    temp.erase(0,1);\n                    if (s[ws] == \'1\')   count -= 1;\n                    ws += 1;\n                }\n            }\n            we += 1;\n        }\n        \n        return ans;\n    }\n};\n```
['C++']