DFS Java Solution
\nclass Solution {\n    public String findLexSmallestString(String s, int a, int b) {\n        ans = s;\n        HashSet<String> vis = new HashSet<>();\n       
```\nclass Solution {\n    public String findLexSmallestString(String s, int a, int b) {\n        ans = s;\n        HashSet<String> vis = new HashSet<>();\n        helper(s, a, b, vis);\n        return ans;\n    }\n    \n    String ans;\n    public void helper(String s, int a, int b, HashSet<String> vis){\n        if(vis.contains(s)) return;\n        if(s.compareTo(ans)<0) ans = s;\n        vis.add(s);\n        helper(perform_a(s, a), a, b, vis);\n        helper(perform_b(s, b), a, b, vis);\n    }\n    \n    public String perform_a(String s, int a){\n        StringBuilder sb = new StringBuilder("");\n        int i = 0;\n        for(char ch:s.toCharArray()){\n            int x = ch - \'0\';\n            if(i%2!=0) x = (x + a)%10;\n            sb.append(x+"");\n            i++;\n        }\n        return sb.toString();\n    }\n    \n    public String perform_b(String str, int b){\n        String f = str.substring(str.length()-b);\n        String s = str.substring(0, str.length()-b);\n        return f + s;\n    }\n    \n}\n```
[]