[JavaScript] 2697. Lexicographically Smallest Palindrome
---\n\nWeekly Contest 346 solutions:\n- Q1 - https://leetcode.com/problems/minimum-string-length-after-removing-substrings/solutions/3547566/javascript-2696-min
---\n\nWeekly Contest 346 solutions:\n- Q1 - https://leetcode.com/problems/minimum-string-length-after-removing-substrings/solutions/3547566/javascript-2696-minimum-string-length-after-removing-substrings/\n- Q2 - https://leetcode.com/problems/lexicographically-smallest-palindrome/solutions/3547563/javascript-2697-lexicographically-smallest-palindrome/\n- Q3 - https://leetcode.com/problems/find-the-punishment-number-of-an-integer/solutions/3547553/javascript-2698-find-the-punishment-number-of-an-integer/\n\n---\n\n\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nconst makeSmallestPalindrome = function (s) {\n  const n = s.length\n  s = s.split(\'\')\n  const halfN = Math.trunc(n / 2)\n  for (let i = 0; i < halfN; i++) {\n    if (s[i] !== s[n - 1 - i]) {\n      if (s[i] < s[n - 1 - i]) {\n        s[n - 1 - i] = s[i]\n      } else {\n        s[i] = s[n - 1 - i]\n      }\n    }\n  }\n  return s.join(\'\')\n}\n\n```
['JavaScript']