Using Sliding Window in DART
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n  String shortestBeautifulSubstring(String s, int k) {\n    int count =0;\n    String res ="";\n    int mins=1000;\n    int left =0;\n    int right =0;\n    int len = s.length;\n    while(right<len ){\n        if(s[right]=="1"){\n            count++;\n            while(count>=k){\n                if(mins >= right-left && count ==k){\n                    if(mins==right-left){\n                    res= checkbig(res, s.substring(left,right+1));\n                    }else{\n                        res=s.substring(left,right+1);\n                    }\n                    mins = right-left;\n\n                }\n                if(left>=right){\n                    break;\n                }\n                if(s[left]=="1"){\n                    left++;\n                    count--;\n                }else{\n                    left++;\n                }\n            }\n           \n        }\n        right++;\n    }\n    print(mins);\n    return res;\n\n\n  }\n\n  checkbig(String s1 ,String s2){\n    for(int i =0;i<s1.length;i++){\n        if(s1[i]=="1" && s2[i]=="0"){\n            return s2;\n        }\n        else if(s1[i]=="0" && s2[i]=="1"){\n            return s1;\n        }\n    }\n    return s1;\n\n  }\n}\n```
['Dart']