Ad
  • Default User Avatar

    I'm almost siting all night, trying to solve this task. If you are so smart find error in my solution! Why it doesn't pass random test?
    function permuteAPalindrome (input) {
    let arr = input.split('');
    const uniqueArr = [];

    for (let i = 0; i < arr.length; i++) {
    if (arr.indexOf(arr[i]) === arr.lastIndexOf(arr[i])) {
    uniqueArr.push(arr[i]);
    }
    }
    if( (uniqueArr.length < 1) || (uniqueArr.length === 1) ) return true;
    else if (uniqueArr.length > 1) return false;
    }

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Really interesting simple task. I am so excited to complete it.

  • Custom User Avatar

    This solution maybe wrong : 4. comma "," can't be in start or end