Java 1 ms solution with explanation
\n1. Store array element, index mapping in a hashmap.\n2. Iterate through the pieces array, \n\t2.1 if length of piece is 1 and the element is contained in hash
\n1. Store array element, index mapping in a hashmap.\n2. Iterate through the pieces array, \n\t2.1 if length of piece is 1 and the element is contained in hashmap, *continue*\n\t2.2 else if length is more than 1 and first element is contained in hashmap, iterate through rest of the elements of the piece. If index of each in the hashmap is not 1 more than the index of the previous *return false*\n\t2.3 else *return false*\n3. Return true (if we reach here, we have verified the index in the hashmap so that we can reconstruct the array with the pieces)\n\n\n```\nclass Solution {\n    public boolean canFormArray(int[] arr, int[][] pieces) {\n        \n        Map<Integer, Integer> map = new HashMap<>();\n        for(int i=0;i<arr.length;i++)\n        {\n            map.put(arr[i], i);\n        }\n        \n        for(int[] piece : pieces)\n        {\n            if(piece.length==1 && map.containsKey(piece[0]))\n                continue;\n            else if(piece.length>1 && map.containsKey(piece[0]))\n            {\n                int cur = map.get(piece[0]);\n                for(int j=1;j<piece.length;j++)\n                {\n                    cur++;\n                    if(map.containsKey(piece[j]) && cur!=map.get(piece[j]))\n                        return false;\n                }\n            }\n            else\n                return false;\n        }\n        return true;\n    }\n}\n```
[]