Simple C++ Solution | ( with video )
\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n        int n=arr.size();\n        vector<int>check(n,0);\n
```\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n        int n=arr.size();\n        vector<int>check(n,0);\n        for(auto i : pieces){\n            bool placed=false;\n            for(int j=0;j<n;j++){\n                if(i[0]==arr[j] && check[j]==0){\n                    bool ok=true;\n                    for(int k=0;k<(int)i.size();k++){\n                        if(j+k<n && i[k]==arr[j+k] && check[j+k]==0) continue;\n                        else ok=false;\n                    }\n                    if(ok){\n                        for(int k=0;k<(int)i.size();k++) check[j+k]=1;\n                        placed=true;\n                    }\n                }\n                if(placed) break;\n            }\n            if(placed==false) return false;\n        }\n        return true;-\n    }\n};\n```
[]