Solution Lexicographically Smallest String After Applying Operations
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    private $ans = "";\n\n    private function f($s, $a, $b, &$st) {\n        if (isset($st[$s])) return;\n        $st[$s] = true;\n        if ($this->ans === "") $this->ans = $s;\n        $this->ans = min($this->ans, $s);\n\n        $temp = substr($s, -$b);\n        $s = substr($s, 0, strlen($s) - $b);\n        $s = $temp . $s;\n        $this->f($s, $a, $b, $st);\n\n        $s = substr($s, $b) . substr($s, 0, $b);\n\n        for ($i = 1; $i < strlen($s); $i += 2) {\n            $s[$i] = chr((((intval($s[$i]) + $a) % 10) + ord(\'0\')));\n        }\n        $this->f($s, $a, $b, $st);\n    }\n\n    public function findLexSmallestString($s, $a, $b) {\n        $st = [];\n        $this->f($s, $a, $b, $st);\n        return $this->ans;\n    }\n}\n\n```
['PHP']