Test case is wrong on OJ but right in my computer


  • 0
    W

    class Solution{
    public:
    bool isScramble(string s1,string s2){
    if(s1.length()!=s2.length())
    return false;
    int len=s1.length();
    if(len==0)
    return true;
    bool result=false;
    for(int i=0;i<len;++i){
    if(s2[i]==s1[0]){
    result=isScramble(s1.substr(1,i),s2.substr(0,i))&&isScramble(s1.substr(i+1,len-i-1),s2.substr(i+1,len-i-1));
    if(result)
    return result;
    }
    }
    return result;
    }
    };
    your help is appreciated!


Log in to reply
 

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