Easy to understand JavaScript solution (DFS)
Complexity\nO(n^2)\n\n# Space complexity:\nO(n)\n\n# Code\n\nvar findLexSmallestString = function(s, a, b) {\n    const visited = new Set();\n    let result = s
# Complexity\n$$O(n^2)$$\n\n# Space complexity:\n$$O(n)$$\n\n# Code\n```\nvar findLexSmallestString = function(s, a, b) {\n    const visited = new Set();\n    let result = s;\n    const add = (value) => {\n        let result = \'\';\n\n        for (let index = 0; index < value.length; index++) {\n            const current = +value[index];\n\n            result += index % 2 ? (current + a) % 10 : current;\n        }\n        return result;\n    };\n    const rotate = (value) => value.slice(b) + value.slice(0, b);\n    const applyOperation = (value) => {\n        if (visited.has(value)) return;\n        visited.add(value);\n        if (result > value) result = value;\n        applyOperation(add(value));\n        applyOperation(rotate(value));\n    };\n\n    applyOperation(s);\n    return result;\n};\n```
['JavaScript']