Easy To Understand C++ Solution || Beats 100% ✅✅
Code\n\nclass Solution {\npublic:\n    string helper(string temp1,string temp2){\n        int n=temp1.length();\n        for(int i=0;i<n;i++){\n            if(t
# Code\n```\nclass Solution {\npublic:\n    string helper(string temp1,string temp2){\n        int n=temp1.length();\n        for(int i=0;i<n;i++){\n            if(temp1[i]>temp2[i]){\n                return temp2;\n            }\n            if(temp1[i]<temp2[i]){\n                return temp1;\n            }\n        }\n        return temp1;\n        \n    }\n    string shortestBeautifulSubstring(string s, int k) {\n        int n=s.length();\n        string temp="";\n        int len=0;\n        int minu=INT_MAX;\n        string ans="";\n        int use=0;\n        for(int i=0;i<n;i++){\n            temp="";\n            use=0;\n            len=0;\n            for(int j=i;j<n;j++){\n                if(s[j]==\'1\'){\n                    use++;\n                }\n                temp+=s[j];\n                len++;\n                if(use==k && len<minu){\n                    minu=len;\n                    ans=temp;\n                }else if(use==k && len==minu){\n                    ans=helper(ans,temp);\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']