Longest palindrome: My program get runtime error in leetcode but it returns right answer on my laptop
<p>My program is below:</p>

<pre><code>string longestPalindrome(string s) {
if(s.size() &lt;=1 )
    return s;
bool isPalindrome[s.size()][s.size()];
for( int i=0; i &lt; s.size(); ++i ){
    isPalindrome[i][i]=true;
    isPalindrome[i+1][i]=true;
}
int longestPalindromeLength=0;
int startIndex=0;
for( int i=2; i&lt;= s.size(); ++i){//子串长度
    for( int j=0; j &lt;=s.size()-i;++j ){//每个起始位置
        int k=j+i-1;
        if( s[j]==s[k] ){
            if(isPalindrome[j+1][k-1]== true){
                isPalindrome[j][k]=true;
                if( i &gt; longestPalindromeLength ){
                    longestPalindromeLength=i;
                    startIndex=j;
                }
            }else{
                isPalindrome[j][k]=false;
            }
        }else{
            isPalindrome[j][k]=false;
        }
    }
}
return s.substr(startIndex,longestPalindromeLength);
</code></pre>

<p>}</p>

<p>The test case is:</p>

<blockquote>
  <p>azwdzwmwcqzgcobeeiphemqbjtxzwkhiqpbrprocbppbxrnsxnwgikiaqutwpftbiinlnpyqstkiqzbggcsdzzjbrkfmhgtnbujzszxsycmvipjtktpebaafycngqasbbhxaeawwmkjcziybxowkaibqnndcjbsoehtamhspnidjylyisiaewmypfyiqtwlmejkpzlieolfdjnxntonnzfgcqlcfpoxcwqctalwrgwhvqvtrpwemxhirpgizjffqgntsmvzldpjfijdncexbwtxnmbnoykxshkqbounzrewkpqjxocvaufnhunsmsazgibxedtopnccriwcfzeomsrrangufkjfzipkmwfbmkarnyyrgdsooosgqlkzvorrrsaveuoxjeajvbdpgxlcrtqomliphnlehgrzgwujogxteyulphhuhwyoyvcxqatfkboahfqhjgujcaapoyqtsdqfwnijlkknuralezqmcryvkankszmzpgqutojoyzsnyfwsyeqqzrlhzbc</p>
</blockquote>

<p>When I run the code above in leetcode, it gives runtime error. But when I test it on my laptop, It gives the right answer: <code>"sooos"</code></p>

<p>What's wrong with my code?</p>