Easiest Solution Ever
\n# Complexity\n- Time complexity:\nO(N)^2\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution:\n    def shortestBeautifulSubstring(self, s: str, k: int) -
\n# Complexity\n- Time complexity:\nO(N)^2\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution:\n    def shortestBeautifulSubstring(self, s: str, k: int) -> str:\n        ans = None \n        n = len(s)\n        \n        for i in range(n):\n            for j in range(i, n):\n                sub_str = s[i:j+1]\n                if sub_str.count(\'1\') == k:\n                    if ans is None or len(sub_str) < len(ans):\n                        ans = sub_str\n                    elif len(sub_str) == len(ans):\n                        if sub_str < ans:\n                            ans = sub_str\n        \n        return ans if ans is not None else ""\n```
['Python3']