check if an array is sub-array of another using hashing
#include <iostream>
#include<map>
using namespace std;
int main() {
int a[100],b[100],n,m,i,j=1;
map<int ,int>m1;
cin>>n>>m;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<m;i++)
cin>>b[i];
for(i=0;i<n;i++)
m1[a[i]]=i;
for(i=0;i<m;i++)
{
if(m1.find(b[i])==m1.end())
{
j=0;
break;
}
}
if(j==0)
cout<<"no";
else
cout<<"yes";
return 0;
}INFO