Simple sliding window beats 100%
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    public String shortestBeautifulSubstring(String s, int k) {\n        int n = s.length();\n        int l = 0;\n        int count = 0;\n        String res = "";\n        for (int r = 0; r < n; r++) {\n            if (s.charAt(r) == \'1\') {\n                count++;\n            }\n            while (count >= k) {\n                String tmp = s.substring(l, r + 1);\n                res = res.equals("") || compare(res, tmp) ? tmp : res;\n                if (s.charAt(l) == \'1\') count--;\n                l++;\n            }\n        }\n        return res;\n    }\n\n    boolean compare(String a, String b) {\n        if (a.length() != b.length()) {\n            return a.length() > b.length();\n        }\n        return a.compareTo(b) > 0;\n    }\n}\n```
['Java']