title: Write a function that returns the longest palindrome in a given string
body: <blockquote>
    <p>e.g "ccddcc" in the string "abaccddccefe"  </p>
  </blockquote>
  
  <p>I thought of a solution but it runs in O(n^2) time</p>
  
  <p>Algo 1:</p>
  
  <p>Steps:
  Its a brute force method</p>
  
  <ol>
  <li>Have 2 for loops<br>
  for i = 1 to i less than array.length -1<br>
  for j=i+1 to j less than array.length   </li>
  <li>This way you can get substring of every possible combination from the array</li>
  <li>Have a palindrome function which checks if a string is palindrome</li>
  <li>so for every substring (i,j) call this function, if it is a palindrome store it in a string variable</li>
  <li>If you find next palindrome substring and if it is greater than the current one, replace it with current one.</li>
  <li>Finally your string variable will have the answer</li>
  </ol>
  
  <p>Issues:
  1. This algo runs in O(n^2) time.</p>
  
  <p>Algo 2:</p>
  
  <ol>
  <li>Reverse the string and store it in diferent array</li>
  <li>Now find the largest matching substring between both the array</li>
  <li>But this too runs in O(n^2) time</li>
  </ol>
  
  <p>Can you guys think of an algo which runs in a better time. If possible O(n) time</p>