Short Python BFS and DFS solutions
Intuition\n Describe your first thoughts on how to solve this problem. \nThe brute force solution works here.\n\n# DFS Code\n\nclass Solution:\n    def findLexS
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe brute force solution works here.\n\n# DFS Code\n```\nclass Solution:\n    def findLexSmallestString(self, s: str, a: int, b: int) -> str:\n        def dfs(s):\n            if s in seen: return\n            seen.add(s)\n            dfs(\'\'.join(s[i] if i % 2 == 0 else str((int(s[i]) + a) % 10) for i in range(len(s))))\n            dfs(s[-b:] + s[:-b])\n        seen = set()\n        dfs(s)\n        return min(seen)\n```\n\n# BFS Code\n```\nclass Solution:\n    def findLexSmallestString(self, s: str, a: int, b: int) -> str:\n        q, seen = [s], set()\n        while q:\n            s = q.pop()\n            if s in seen: continue\n            seen.add(s)\n            t = \'\'.join(s[i] if i % 2 == 0 else str((int(s[i]) + a) % 10) for i in range(len(s)))\n            u = s[-b:] + s[:-b]\n            q.extend([t, u])\n        return min(seen)\n```
['Python3']