You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Write a JavaScript program to find the shortest possible string. This can be converted into a string and converted into a palindrome by adding characters to the end of it.
function buildPalindrome(newStr) {
var flag;
for (let i = newStr.length; ; i++) {
flag = true;
for (let j = 0; j < i - j - 1; j++) {
if (i - j - 1 < newStr.length && newStr[i] != newStr[i - j - 1]) {