Check if you need to change character, if yes, change to smaller
Intuition\nCheck for every position until the half of the string, check if elements are the same:\n - if yes, nothing to be done\n - if no, modify one of them b
# Intuition\nCheck for every position until the half of the string, check if elements are the same:\n - if yes, nothing to be done\n - if no, modify one of them by changing it to a smaller character\n\n\n\n# Complexity\n- Time complexity: $O(n)$\n- Space complexity: $O(n)$\n\n# Code\n\n```Rust []\nimpl Solution {\n  pub fn make_smallest_palindrome(s: String) -> String {\n    let l = s.len();\n    let mut s: Vec<char> = s.chars().collect();\n    for i in 0 .. l / 2 {\n      if s[i] != s[l - i - 1] {\n        let v = s[i].min(s[l - i - 1]);\n        s[i] = v;\n        s[l - i - 1] = v;\n      }\n    }\n\n    return s.into_iter().collect();\n  }\n}\n```\n```python []\nclass Solution:\n  def makeSmallestPalindrome(self, s: str) -> str:\n    s, l = list(s), len(s)\n    for i in range(l // 2):\n      if s[i] != s[l - i - 1]:\n        c = min(s[i], s[l - i - 1])\n        s[i], s[l - i - 1] = c, c\n    \n    return \'\'.join(s)\n```\n
['Python3', 'Rust']