i get a error like this picture when i submit my codes


  • 0
    0

    using std::string;
    class Solution {
    public:
    string longestPalindrome(string s) {
    int i=0,j=0;
    int n;
    unsigned int len=s.length();
    bool subf=true;
    std::map<string,int> iq;
    string max_str;
    string cur_str;
    if(len<=1)
    {
    max_str=s;
    }
    for(i=0;i<len;i++)
    {
    for(j=i+1;j<len;j++)
    {
    if(s[i]==s[j])
    {
    static int k=i+1;
    while(k<j)
    {
    iq.insert(make_pair("s[k]",k));
    k++;
    }
    for(n=i+1;n<j;n++)
    {
    if(iq.count("s[n]")>1)
    {
    subf=false;
    }
    }
    if(subf)
    {
    cur_str=s.substr(i,j-i+1);
    }
    if(cur_str.size()>=max_str.size())
    {
    max_str=cur_str;
    }

                }
                
            }
        }
        return max_str;
    }
    

    };
    0_1489806916539_upload-d56ac9d5-8ac5-42ca-961e-53f933330f3e


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.