Easy and Simple Solution to understand
IntuitionA palindrome is a string that reads the same forward and backward. Our goal is to convert the given string into the lexicographically smallest palindro
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
A palindrome is a string that reads the same forward and backward. Our goal is to convert the given string into the lexicographically smallest palindrome with minimal modifications.

To achieve this, we use a two-pointer approach:

 1. Compare characters from both ends (left and right).
  1. If they are different, replace the larger character with the smaller one to get the smallest lexicographical order.
1. Continue this process until we process the entire string.


# Approach
<!-- Describe your approach to solving the problem. -->
1. Initialize Two Pointers:
  - left = 0 (starting index)
  - right = s.length() - 1 (ending index)

2. Use a StringBuilder for Mutability:
   - Since String is immutable in Java, we use StringBuilder to modify characters efficiently.

3. Iterate Until left Meets right:

-   If s.charAt(left) == s.charAt(right), move both pointers inward.
 If they are different:
  -   Replace the larger character with the smaller one to ensure lexicographically smallest order.
-    Modify sb accordingly.

4. Return the Modified String:

   - After processing all characters, return sb.toString().



# Complexity
- Time complexity:O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public String makeSmallestPalindrome(String s) {
        int left = 0;
        int right = s.length() - 1;
        StringBuilder sb = new StringBuilder(s);
        
        while (left < right) {
            if (s.charAt(left) != s.charAt(right)) {
                if (s.charAt(left) > s.charAt(right)) {
                    sb.setCharAt(left, s.charAt(right)); 
                } 
                else {
                    sb.setCharAt(right, s.charAt(left)); 
                }
            }
            left++;
            right--;
        }
        return sb.toString();
    }
}

```
['Two Pointers', 'String', 'Java']