c++ O(n) solution Two Pointers
\n Describe your first thoughts on how to solve this problem. \n\n# Approach: Two Pointers\n Describe your approach to solving the problem. \n\n# Complexity\n- 
\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach: Two Pointers\n<!-- Describe your approach to solving the problem. -->\n\n# 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 {\npublic:\n    string makeSmallestPalindrome(string s) {\n        string ans = s; // because changing the given data is not good practice\n        int i = 0, j = s.size() - 1;\n        while(i < j) {\n            if(ans[i] != ans[j]) {\n                if(ans[i] < ans[j]) ans[j] = ans[i];\n                else ans[i] = ans[j];\n            }\n            i++, j--;\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'String', 'C++']