C++ 100% , Time complexity O(NLogN). Using Hash Map.
\n\n\n\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& p) {\n        int sum_p =0;\n        map<int,vector<int>> mp;\n 
\n\n```\n\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& p) {\n        int sum_p =0;\n        map<int,vector<int>> mp;\n        \n        for(int i =0 ;i <p.size() ;i++){\n            mp.insert(pair<int,vector<int>>(p[i][0],p[i]));\n        }\n        int index =0 ;\n        int key = arr[0];\n        if(mp.find(key) == mp.end())return false;\n        \n        for(int i=0; i< arr.size() ; i++){\n            if(index == mp[key].size()){\n                index =0 ;\n                key = arr[i];\n            }\n            if(mp.find(key) == mp.end())return false;\n            if(mp[key][index] != arr[i])return false;\n            ++index;\n            \n        }\n        \n        return true;\n        \n    }\n};\n\n```
[]