[Solved] Shortest and Lexicographically Smallest Beautiful String C++, Java , Python
![[Solved] Shortest and Lexicographically Smallest Beautiful String C++, Java , Python Lexicographically](https://realcoder.techss24.com/wp-content/uploads/2023/10/output-40-768x512.png)
You are given a binary string s and a positive integer k. A substring of s is beautiful if the number of 1‘s in it is exactly k. Let len be the length of the shortest beautiful substring. Return the lexicographically smallest beautiful substring of string s with length equal to len. If s doesn’t contain a beautiful substring, return an empty string. A…