Sliding window + two pointer approach 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    string shortestBeautifulSubstring(string s, int k) {
        int n = s.length();
        int j = 0;
        int i =0;

        string ans = "";
        int count = 0;
        int start = -1;
        int end = -1;
        int mini = INT_MAX;

        //keep track of start and end index  whose diff is min 
        while(j<n){
            if(s[j]=='1'){
                
                count++;
            }
            while(count==k){

                int currdiff= j-i+1;
                if (currdiff < mini || (currdiff == mini && s.substr(i, currdiff) < ans)) {
                    mini = currdiff;
                    start = i;
                    end = j;
                    ans = s.substr(i, currdiff);  // Store the current substring
                }

                if(s[i]=='1'){
                    count--;
                }
                i++;

            }
            
            
            j++;
            
        }
        
        
        if (start == -1) return "";  // No valid substring found
        return s.substr(start, end - start + 1);

    }
};
```
['C++']