title: The fastest method of determining if a string is a palindrome
body: <p>I need an algorithm that verify with the fastest possible execution time, if a string is a palindrome ( the string can be a proposition with uppercase or lowercase letter, spaces etc.). All of this in Java. I got a sample :</p>
  
  <pre><code>bool isPalindrome(string s) {
      int n = s.length();
      s = s.toLowerCase();
      for (int i = 0; i &lt; (n / 2) + 1; ++i) {
          if (s.charAt(i) != s.charAt(n - i - 1)) {
              return false;
          }
      }
      return true;
  }
  </code></pre>
  
  <p>I transformed the string in lowercase letter using <code>.toLowerCase()</code> function, but I don't know how much it affects the execution time .</p>
  
  <p>And as well I don't know how to solve the problem with punctuation and spaces between words in a effective way.</p>