slogp solution 2test case not passed


  • 0
    K

    class Solution {
    public:
    vector<int> findAnagrams(string s, string p) {
    vector< int >hi;
    sort(p.begin(),p.end());
    int psize=p.size();
    if(s.size()>=psize){
    for(int i=0;i<=s.size()-psize;i++)
    {
    string temp=s.substr(i,psize);
    sort(temp.begin(),temp.end());
    if(temp==p){hi.push_back(i);}
    }
    }
    else{return hi;}
    return hi; }
    };


Log in to reply
 

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