Java | Easy Solution
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n  public String smallestString(String s) {\n    var c = s.toCharArray();\n    int start = 0, end = 0;\n    \n    for (var i=0; i < c.length; i++, end++)\n      if (c[i] == \'a\')\n        if (start == end) start++;\n        else break;\n    \n    if (start == end) start--;\n    \n    for (var i = start; i < end; i++)\n      if (c[i] == \'a\') c[i] = \'z\';\n      else c[i]--;\n    \n    return new String(c);\n  }\n}\n```\nIf you like my solution, please upvote it!
['Java']