Java- HashMap- 1ms- Easy to Understand Solution
\npublic boolean canFormArray(int[] arr, int[][] pieces) {\n        Map<Integer, Integer> positionMap = new HashMap<>();\n\t\t#Store positions of all the elemen
```\npublic boolean canFormArray(int[] arr, int[][] pieces) {\n        Map<Integer, Integer> positionMap = new HashMap<>();\n\t\t#Store positions of all the elements of arr\n        for(int i = 0; i < arr.length; i++)\n            positionMap.put(arr[i], i);\n\n        for(int[] piece: pieces){\n\t\t\t#First element does not have any position in original arr\n            if(!positionMap.containsKey(piece[0])) return false;\n            for(int i = 1; i < piece.length; i++) {\n\t\t\t\t#Whether element exists in original arr and appears next to the previous element\n                if(!positionMap.containsKey(piece[i])) return false;\n                if(positionMap.get(piece[i]) - positionMap.get(piece[i-1]) != 1) return false;\n            }\n        }\n\n        return true;\n}\n```
['Java']