DFS + Bruteforce
Code\n\nclass Solution {\npublic:\n    unordered_set<string> visited;\n    string res;\n    string add(string s, int a) {\n        int n = s.size(); \n        f
# Code\n```\nclass Solution {\npublic:\n    unordered_set<string> visited;\n    string res;\n    string add(string s, int a) {\n        int n = s.size(); \n        for(int i=1; i<n; i+=2) {\n            int curr = (s[i]-\'0\' + a) % 10;\n            s[i] = curr+\'0\';\n        }\n        return s; \n    }\n    \n    string rotate(string s, int b) {\n        int n = s.size();\n        string s1 = s.substr(n - b, b);\n        string s2 = s.substr(0, n - b);\n        return s1 + s2; \n    }\n\n    void dfs(string s, int a, int b) {\n        if (visited.find(s) != visited.end()) {\n            return ;\n        }\n        res = res.compare(s) > 0 ? s : res;\n        visited.emplace(s);\n        dfs(rotate(s, b), a, b);\n        dfs(add(s, a), a, b);\n    }\n\n    string findLexSmallestString(string s, int a, int b) {\n        res = s;\n        dfs(s, a, b);\n        return res;\n    }\n};\n```
['Depth-First Search', 'C++']