[C++] O(n), clean code and easy to understand.
\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n        unordered_map<int, int> mp;\n        \n        for 
```\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n        unordered_map<int, int> mp;\n        \n        for (int i = 0; i < pieces.size(); ++i) {\n            mp[pieces[i][0]] = i;\n        }\n        \n        for (int i = 0; i < arr.size();) {\n            if (mp.find(arr[i]) == mp.end()) {\n                return false;\n            }\n            \n            auto piece = pieces[mp[arr[i]]];\n            \n            for (int j = 0; j < piece.size(); ++j, ++i) {\n                if (arr[i] != piece[j]) {\n                    return false;\n                }\n            }\n        }\n        \n        return true;\n    }\n};\n```
[]