Lexicographically Smallest Palindrome (JavaScript | Two Pointers)
Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n\n/**\n * @param {string} s\n * @return {string}\n */\nvar makeSmallestPalindrome =
# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```\n/**\n * @param {string} s\n * @return {string}\n */\nvar makeSmallestPalindrome = function(s) {\n    let left = 0;\n    let right = s.length - 1;\n    let str = s.split(\'\');\n\n    while(left < right) {\n        if(str[left] !== str[right]) {\n            if (str[left] < str[right]) {\n                str[right] = str[left];\n            } else {\n                str[left] = str[right];\n            }\n        }\n        left++;\n        right--;\n    }\n\n    return str.join(\'\');\n};\n```
['Two Pointers', 'JavaScript']