title: Longest Palindrome in integer array
body: <p>I want to find the largest palindrome in an integer array. I tried making my own algorithm and not looking at the online ones. But this is not working. I tried doing debugging but couldn't get it to work.</p>
  <p><strong>Sample input:</strong></p>
  <p>&quot;1367611342142412431113424823782&quot;</p>
  <p>Output: 113421424124311</p>
  <pre><code>void palindrome()
  {
      int max = 0;
      int len;
      int start;
      int end;
      int st=0,en=0;
      bool palin = false;
      for(int i=0;i&lt;size;i++)
      {
          for(int j=size-1; j&gt;=0;j--)
          {
              if(array[i] == array[j])
              {
                  start = i;
                  end = j;
                  while(j==i+1 || j+1 == i || j == i )
                  {
                      if(array[i] == array[j])
                      {
                          i++; 
                          j--;
                          palin = true;
                      }
                      else
                      {
                          palin = false;
                          break;  
                      }
                  }
                  i= start;
                  j= end;
              }
              if(palin == true)
                  {
                      len = end - start;
                      if(len&gt;max)
                      {
                          cout&lt;&lt;&quot; &quot;&lt;&lt;st&lt;&lt;&quot; &quot;&lt;&lt;en&lt;&lt;endl;
                          st=i;
                          en =j;
                          max = len;
                      }
                  }
          }
      }
      cout&lt;&lt;endl;
      cout&lt;&lt;st&lt;&lt;&quot; &quot;&lt;&lt;en&lt;&lt;endl;
      ofstream file(&quot;output.txt&quot;);
      for(int i=st;i&lt;=en;i++)
      {
          file&lt;&lt;array[i];
      }
  }
  
  </code></pre>