c++ | easy | fast
\n\n# Code\n\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n\n        unordered_map <int, int> mp;\n       
\n\n# Code\n```\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n\n        unordered_map <int, int> mp;\n        \n        for(int i = 0; i<arr.size(); i++){\n            \n            mp[arr[i]] = i;\n            \n        }\n        \n        int temp = -1;\n        unordered_map <int, int> :: iterator map_it;\n        for(auto it : pieces){\n            \n            for(auto pr : it){\n                \n                if(mp.find(pr) != mp.end()){\n                    if(temp == -1){\n                    map_it = mp.find(pr);\n                    temp = map_it -> second;   \n                    }\n                    map_it = mp.find(pr);\n                    if(temp++ != map_it -> second) return false;                    \n                }\n                else return false;\n            }\n            temp = -1;\n        }\n        return true;\n    }\n};\n```
['C++']