C++
(```)  class Solution {\npublic:\n    bool canFormArray(vector& arr, vector>& pieces) {\n       \n        unordered_map> mp;\n        \n        for(auto x: piec
(```)  class Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n       \n        unordered_map<int,vector<int>> mp;\n        \n        for(auto x: pieces)\n        {\n            mp[x[0]] = x;\n        }\n        \n        vector<int> res;\n        \n        for(auto x: arr)\n        {\n           if(mp.find(x) != mp.end()) \n           {\n               res.insert(res.end(), mp[x].begin(),mp[x].end());\n           }\n        }\n        \n        return res == arr;\n    }\n};
[]