🔥Java Solution || Easy to Understand
\nclass Solution {\n    public String shortestBeautifulSubstring(String s, int k) {\n        int n = s.length();\n\n        List<Integer> list = new ArrayList<>
```\nclass Solution {\n    public String shortestBeautifulSubstring(String s, int k) {\n        int n = s.length();\n\n        List<Integer> list = new ArrayList<>();\n        for(int i = 0; i < n; i++) {\n            if(s.charAt(i) == \'1\') list.add(i);\n        } \n        \n        int minLen = n;\n        for(int i = 0; i <= list.size()-k; i++) minLen = Math.min(list.get(i+k-1) - list.get(i) + 1, minLen);\n\n        List<String> list2 = new ArrayList<>();\n        for(int i = 0; i <= list.size()-k; i++) {\n            if(list.get(i+k-1) - list.get(i) + 1 == minLen) list2.add(s.substring(list.get(i), list.get(i+k-1))+1);\n        }\n        \n        return list2.size() > 0 ? lexicographicallySmallest(list2) : "";\n    }\n\n    private String lexicographicallySmallest(List<String> list) {\n        String smallest = list.get(0);\n        \n        for(String str : list) {\n            for(int i = 0; i < str.length(); i++) {\n                if(smallest.charAt(i) != str.charAt(i)) {\n                    if(str.charAt(i) == \'0\') smallest = str;\n                    break;\n                }\n            }\n        }\n\n        return smallest;\n    }\n}\n```
['Java']