title: What edge cases am I missing for palindromeIndex()?
body: <p>I have submitted this code to hacker rank but it only passes 10 / 15 cases.  The 5 that it does not pass are hidden.</p>
  <p>What edge cases are missing?  The code is allowed to remove one character from a string to make a palindrome.</p>
  <p>This is a brute force approach checking for each letter at index i, being removed.  If it is already a palindrome or a palindrome does not exist, it returns -1.</p>
  <pre><code>function palindromeIndex(string) {
    if(isPalindrome(string)) {
      return -1
    }
    for(let i = 0; i &lt; string.length; i++) {
      let new_string = removeCharacter(string, i);
      if(isPalindrome(new_string)) {
        return i;
      }
    }
    return -1;
  }
  
  function removeCharacter(string, i) {
    return string.slice(0, i) + string.slice(i + 1);
  }
  
  function isPalindrome(string) {
    for(let i = 0; i &lt; string.length / 2; i++) {
      if(string[i] !== string[string.length - 1 - i]) {
        return false;
      }
    }
    return true;
  }
  
  
  console.log(palindromeIndex('aacbbaa'));
  </code></pre>