[C++] Array-based Solution Explained, 100% Time, ~75% Space
As a little forenote, this problem might be solved using a hashamp (like an unordered_map in C++) to keep track of where is each piece that starts with a given 
As a little forenote, this problem might be solved using a hashamp (like an `unordered_map` in C++) to keep track of where is each piece that starts with a given number, but given the very limited range (`1 - 100`) and the vastly superior performance of an array, \xE7a va sans dire what I decided to pick.\n\nSo, in order to start our to verify if we can effectively assemble all the vectors in `pieces`, we will first of all create an array of integers called `startAt`, with size `101` (so that we can accept indexes up to `100`, leaving index `0` unused instead of have to subtract `1` for each access later) and then initialise it with all its cell to be `== -1`.\n\nOn another loop, we will take each subvector in `pieces` and store its index in the cell of `startAt` matching its first element - so, for example, if `pieces` was `{{26, 35, 81}, {6, 14, 51}, {8, 72}}` we will store `0`, `1` and `2` in the cells with index `26`, `6` and `8` respectively.\n\nTime now for our main loop!\n\nIn it we will parse with pointer `i` through `arr` and\n* first of all if we have a chunk position stored in `startAt` - if not, we can confidently return `false`;\n* otherwise we know we have one valid chunk, so we parse through all of it to check if each single element matches in exactly that order:\n\t* for a mismatch we again return `false`;\n\t* for a match we go on, increasing `i` accordingly.\n\nIf we managed to come out of the main loop, it means all the elements in `arr` were parsed successfully composing all the element in `pieces`, so we can return `true` ;)\n\nThe code:\n\n```cpp\nclass Solution {\npublic:\n    bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n        int startAt[101];\n        // populating startAt\n        for (int i = 1; i < 101; i++) startAt[i] = -1;\n        for (int i = 0, len = pieces.size(); i < len; i++) {\n            startAt[pieces[i][0]] = i;\n        }\n        // parsing arr\n        for (int i = 0, len = arr.size(); i < len;) {\n            // checking if we do not have a matching chunk\n            if (startAt[arr[i]] == -1) return false;\n            // verifying the whole chunk matches\n            for (int n: pieces[startAt[arr[i]]]) {\n                if (n != arr[i]) return false;\n                i++;\n            }\n        }\n        return true;\n    }\n};\n```
['C', 'C++']