C++ solution clean


#1

bool find(int A, unordered_map<int,vector>&mp,vector&vis,int B){
if(B==A)return true;

if(vis[B]==false){
    vis[B]=true;
    for(int i=0;i<mp[B].size();i++){
        bool found=find(A,mp,vis,mp[B][i]);
        if(found==true)return true;
    }
    vis[B]=false;
    return false;
}
return false;

}

int Solution::solve(int A, vector<vector > &B) {
unordered_map<int,vector>mp;
for(int i=0;i<B.size();i++){
mp[B[i][0]].push_back(B[i][1]);
}
vectorvis(A+1,false);
return find(A,mp,vis,1);
}