[Solved] Shortest and Lexicographically Smallest Beautiful String C++, Java , Python
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…