Quick and short beautiful substring
IntuitionNeed to create all substrings that could be beautiful, meaning that has at least k 1s, and it should start with a 1 and end with a 1 to avoid unnecessa
# Intuition
Need to create all substrings that could be beautiful, meaning that has at least k 1s, and it should start with a 1 and end with a 1 to avoid unnecessary 0s.

# Approach
1. Need to find positions of 1s.
2. Each left-most 1 could create a beautiful substring, so find the shortest possible (avoid 0s at the beginning or end).
3. Find the shortest and smaller substring, that can be done with a min with custom keys, first compare len(x) and then if equal len(x) compare the actual x (substring).

# Complexity
- Time complexity:
It will need O(n) to find the ones, O(m) to find the substrings, where m is the number of 1s that will be at worst n, so O(2*n) = O(n)

- Space complexity:
O(m) because we are storing m substrings, where m is the number of 1s that could be at max equal to n.

# Code
```python3 []
class Solution:
    def shortestBeautifulSubstring(self, s: str, k: int) -> str:
        one_indices = [i for i, c in enumerate(s) if c == '1']
        
        if not one_indices:
            return ''
        
        substrings = []
        for i in range(len(one_indices)-k+1):
            substrings.append(s[one_indices[i]: one_indices[i+k-1]+1])
        
        if not substrings:
            return ''

        return min(substrings, key=lambda x: (len(x), x))
```
['Python3']